예제 #1
0
 public void ScheduleLocalNotification(string text, string action, DateTime date, PromoLocalNotifications.RepeatInterval repeat, IDictionary userInfo)
 {
     if (Wrapper != null)
     {
         if (Manager.Settings.LocalNotificationsEnabled)
         {
             Wrapper.ScheduleLocalNotification(text, action, date, repeat, userInfo);
         }
         else
         {
             Debug.Log("Local notification are disabled in API settings");
         }
     }
 }
예제 #2
0
        public void ScheduleLocalNotification(string text, string action, DateTime date, PromoLocalNotifications.RepeatInterval repeat, IDictionary userInfo)
        {
                        #if UNITY_IOS
            var notif = new UnityEngine.iOS.LocalNotification();

            notif.alertBody = text;
            notif.fireDate  = date;

            if (!string.IsNullOrEmpty(action.Trim()))
            {
                notif.alertAction = action;
            }

            switch (repeat)
            {
            case PromoLocalNotifications.RepeatInterval.Minute:
                notif.repeatInterval = UnityEngine.iOS.CalendarUnit.Minute;
                break;

            case PromoLocalNotifications.RepeatInterval.Hourly:
                notif.repeatInterval = UnityEngine.iOS.CalendarUnit.Hour;
                break;

            case PromoLocalNotifications.RepeatInterval.Daily:
                notif.repeatInterval = UnityEngine.iOS.CalendarUnit.Day;
                break;

            case PromoLocalNotifications.RepeatInterval.Weekly:
                notif.repeatInterval = UnityEngine.iOS.CalendarUnit.Week;
                break;

            case PromoLocalNotifications.RepeatInterval.Monthly:
                notif.repeatInterval = UnityEngine.iOS.CalendarUnit.Month;
                break;
            }

            if (userInfo != null)
            {
                notif.userInfo = userInfo;
            }

            UnityEngine.iOS.NotificationServices.ScheduleLocalNotification(notif);
                        #endif
        }