public async void UpdateRemindersNotifications(IList <TriggeredReminder> featureReminders)
        {
            Tuple <bool, NSError> authResult = await RequestUserAccess();

            if (!authResult.Item1)
            {
                Debug.WriteLine("User denied access to notifications");
                return;
            }
            notificationCenter.RemoveAllPendingNotificationRequests();
            for (int i = 0; i < featureReminders.Count; i++)
            {
                ScheduleReminderNotification(featureReminders[i], i + 1);
            }
        }
Beispiel #2
0
        public void UpdateNotification(string title, string text, bool endCounter)
        {
            UNUserNotificationCenter notifications = UNUserNotificationCenter.Current;

            notifications.RemoveAllPendingNotificationRequests();
            notifications.RemoveAllDeliveredNotifications();

            UILocalNotification notification = new UILocalNotification()
            {
                FireDate    = NSDate.Now,
                AlertTitle  = title,
                AlertAction = title,
                AlertBody   = text
            };

            notification.ApplicationIconBadgeNumber = 0;
            notification.SoundName = UILocalNotification.DefaultSoundName;

            UIApplication.SharedApplication.ScheduleLocalNotification(notification);
        }