private void ScheduleNotification(object obj)
 {
     NotificationScheduleDB = new NotificationScheduleDB();
     ScheduleNotifications();
     NotificationScheduleDB.SetNextNotificationTime();
     DependencyService.Get <ILocalNotifications>().SendLocalNotification();
 }
Esempio n. 2
0
        public override void OnReceive(Context context, Intent intent)
        {
            NotificationDB = new NotificationScheduleDB();
            var ScheduledNotifications = NotificationDB.GetNextNotifications();

            foreach (NotificationSchedule ScheduledNotification in ScheduledNotifications)
            {
                Bundle        Data = GetDataBundle(ScheduledNotification);
                var           NotificationIntent  = GetLaunchIntent(Data);
                PendingIntent ContentIntent       = PendingIntent.GetActivity(Application.Context, 0, NotificationIntent, PendingIntentFlags.UpdateCurrent);
                var           Notification        = GetNotification(ScheduledNotification, ContentIntent);
                var           NotificationManager = NotificationManagerCompat.From(Application.Context);
                NotificationManager.Notify(ScheduledNotification.ID, Notification);
            }
        }