public void CancelLocalNotification(CrossPlatformNotification _notification)
 {
     if (ScheduledLocalNotifications.Contains(_notification))
     {
         ScheduledLocalNotifications.Remove(_notification);
     }
 }
        private void MonitorScheduledLocalNotifications()
        {
            if (ScheduledLocalNotifications == null || ScheduledLocalNotifications.Count == 0)
            {
                return;
            }

            int _scheduledNotificationsCount = ScheduledLocalNotifications.Count;

            System.DateTime _now = System.DateTime.Now;

            for (int _iter = 0; _iter < _scheduledNotificationsCount; _iter++)
            {
                CrossPlatformNotification _scheduledNotification = ScheduledLocalNotifications[_iter];
                int _secondsSinceNow = (int)(_now - _scheduledNotification.FireDate).TotalSeconds;

                // Can fire event
                if (_secondsSinceNow > 0)
                {
                    OnReceivingLocalNotification(_scheduledNotification);

                    // Remove this notification from scheduled list
                    ScheduledLocalNotifications.RemoveAt(_iter);

                    // Update iterator
                    _scheduledNotificationsCount--;
                    _iter--;
                }
            }
        }
        public void ScheduleLocalNotification(CrossPlatformNotification _notification)
        {
            if (0 == (int)m_supportedNotificationTypes)
            {
                return;
            }

            // Add this new notification
            ScheduledLocalNotifications.Add(_notification);
        }
        private void MonitorScheduledLocalNotifications()
        {
            if (ScheduledLocalNotifications == null || ScheduledLocalNotifications.Count == 0)
            {
                return;
            }

            int _scheduledNotificationsCount = ScheduledLocalNotifications.Count;

            System.DateTime _now = System.DateTime.Now;

            for (int _iter = 0; _iter < _scheduledNotificationsCount; _iter++)
            {
                CrossPlatformNotification _scheduledNotification = ScheduledLocalNotifications[_iter];
                int _secondsSinceNow = (int)(_now - _scheduledNotification.FireDate).TotalSeconds;

                // Can fire event
                if (_secondsSinceNow > 0)
                {
                    OnReceivingLocalNotification(_scheduledNotification);

                    // Handle notification based on its repeat interval
                    eNotificationRepeatInterval _repeatInterval = _scheduledNotification.RepeatInterval;

                    switch (_repeatInterval)
                    {
                    case eNotificationRepeatInterval.NONE:
                        // Remove the notification from scheduled list, as its not repeatable
                        ScheduledLocalNotifications.RemoveAt(_iter);
                        _scheduledNotificationsCount--;
                        _iter--;
                        break;

                    case eNotificationRepeatInterval.MINUTE:
                        _scheduledNotification.FireDate = _scheduledNotification.FireDate.AddMinutes(1);
                        break;

                    case eNotificationRepeatInterval.HOUR:
                        _scheduledNotification.FireDate = _scheduledNotification.FireDate.AddHours(1);
                        break;

                    case eNotificationRepeatInterval.DAY:
                        _scheduledNotification.FireDate = _scheduledNotification.FireDate.AddDays(1);
                        break;

                    case eNotificationRepeatInterval.WEEK:
                        _scheduledNotification.FireDate = _scheduledNotification.FireDate.AddDays(7);
                        break;

                    case eNotificationRepeatInterval.MONTH:
                        _scheduledNotification.FireDate = _scheduledNotification.FireDate.AddMonths(1);
                        break;

                    case eNotificationRepeatInterval.YEAR:
                        _scheduledNotification.FireDate = _scheduledNotification.FireDate.AddYears(1);
                        break;

                    default:
                        Console.LogError(Constants.kDebugTag, "[RS] Unhandled notification interval=" + _repeatInterval);
                        break;
                    }
                }
            }
        }
 public void CancelAllLocalNotifications()
 {
     ScheduledLocalNotifications.Clear();
 }