Reputation: 140
Currently i making a med schedule which fires a local notification everyday at the time your med is due, so far i have got it working for the first day but it will not fire again unless the user clicks on the notification.
else if (Device.RuntimePlatform == Device.iOS)
{
App.BadgeCount = App.BadgeCount + 1;
CrossNotifications.Current.Badge = App.BadgeCount;
Random rnd = new Random();
string stringid = rnd.Next(1, 1000000000).ToString();
stringid = CrossNotifications.Current.Send(usermedid, "Please take " + dosage + " of " + medname, "ding", ms);
Debug.WriteLine("Notification saved" + stringid);
Is there any way to add in my code a way to set the notification to repeat daily at that exact time without having to click on the notification ? Would be best to revert to using UILocalNotifications and using the repeat interval ?
Any help appreciated .. Thanks
Upvotes: 0
Views: 54
Reputation: 34013
From what I can see in the ACR source it can only schedule something through tje calendar, so yes, then you will need a manual action to schedule the next one. Also, I think there is a limit to how many notifications you can schedule in the future.
You are mentioning UILocalNotifications, not that this API is deprecated as of iOS 10. You probably want to use the replacement: UNNotificationRequest. Looking at that API, there is a function to schedule notifications with an interval and the option to let them repeat for each interval. In native code this looks like this:
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: (30*60), repeats: false)
That is probably what you are after. So now you need to either find a plugin that supports this, or write something yourself
Upvotes: 2