Unity.Platform.IPhone.IPhoneNotification.ScheduleLocalNotification C# (CSharp) Method

ScheduleLocalNotification() public method

public ScheduleLocalNotification ( NotificationData notification, Unity.Core.Notification.SchedulingData schedule ) : void
notification Unity.Core.Notification.NotificationData
schedule Unity.Core.Notification.SchedulingData
return void
		public override void ScheduleLocalNotification (NotificationData notification, SchedulingData schedule)
		{
			UIApplication.SharedApplication.InvokeOnMainThread (delegate { 
				if(notification!=null) {
					UILocalNotification localNotification = this.PrepareLocalNotification(notification);
					if(schedule != null) {
						localNotification.FireDate = IPhoneUtils.DateTimeToNSDate(DateTime.SpecifyKind(schedule.FireDate, DateTimeKind.Local));
						SystemLogger.Log(SystemLogger.Module.PLATFORM,"Scheduling local notification at " 
						                 + schedule.FireDate.ToLongTimeString() + ", with a repeat interval of: " + schedule.RepeatInterval);
						NSCalendarUnit repeatInterval = 0; // The default value is 0, which means don't repeat.
						if(schedule.RepeatInterval.Equals(RepeatInterval.HOURLY)) {
							repeatInterval = NSCalendarUnit.Hour;
						} else if(schedule.RepeatInterval.Equals(RepeatInterval.DAILY)) {
							repeatInterval = NSCalendarUnit.Day;
						} else if(schedule.RepeatInterval.Equals(RepeatInterval.WEEKLY)) {
							repeatInterval = NSCalendarUnit.Week;
						} else if(schedule.RepeatInterval.Equals(RepeatInterval.MONTHLY)) {
							repeatInterval = NSCalendarUnit.Month;
						} else if(schedule.RepeatInterval.Equals(RepeatInterval.YEARLY)) {
							repeatInterval = NSCalendarUnit.Year;
						} 
						localNotification.RepeatInterval = repeatInterval;
						UIApplication.SharedApplication.ScheduleLocalNotification(localNotification);
						SystemLogger.Log(SystemLogger.Module.PLATFORM, "Local Notification scheduled successfully [" + localNotification.FireDate.ToString() +"]");
						SystemLogger.Log(SystemLogger.Module.PLATFORM, "Current scheduled #num of local notifications: " + this.GetCurrentScheduledLocalNotifications());
					} else {
						SystemLogger.Log(SystemLogger.Module.PLATFORM,"No suitable scheduling data object received for scheduling this local notification");
					}
				} else {
					SystemLogger.Log(SystemLogger.Module.PLATFORM,"No suitable data object received for presenting local notification");
				}
			});
		}