Esempio n. 1
0
    public void RegisterAllNotifications(string title, string body, string largeIcon, int localHours)
    {
        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
#if UNITY_IOS
            var text = $"{title}\n{body}";
            PlatformInterface.instance.logger.Log("Schedule Local Notification");
#pragma warning disable 618
            UnityEngine.iOS.NotificationServices.ClearLocalNotifications();
            UnityEngine.iOS.NotificationServices.CancelAllLocalNotifications();
#pragma warning restore 618
#endif
            ClearAllNotifications();

            // 09:00
#if UNITY_IOS
#pragma warning disable 618
            UnityEngine.iOS.LocalNotification notification0900 = new UnityEngine.iOS.LocalNotification {
                fireDate       = PlatformEditor.GetNextLocalHours(localHours),
                alertBody      = text,
                alertAction    = "Action",
                soundName      = UnityEngine.iOS.LocalNotification.defaultSoundName,
                repeatInterval = UnityEngine.iOS.CalendarUnit.Day
            };
            UnityEngine.iOS.NotificationServices.ScheduleLocalNotification(notification0900);
#pragma warning restore 618
#endif
        }
    }
Esempio n. 2
0
    public void RegisterAllNotifications(string title, string body, string largeIcon, int localHours)
    {
        ClearAllNotifications();

        RegisterDailyChannel();

#if UNITY_ANDROID
        var notification = new AndroidNotification
        {
            Title          = title,
            Text           = body,
            FireTime       = PlatformEditor.GetNextLocalHours(localHours),
            RepeatInterval = TimeSpan.FromDays(1)
        };
        AndroidNotificationCenter.SendNotification(notification, "DailyChannel");
#endif

        PlatformInterface.instance.logger.Log("RegisterAllRepeatingNotifications");
    }
Esempio n. 3
0
 public void Init(object parentContainer)
 {
     ParentContainer = parentContainer;
     m_editor        = new PlatformEditor();
     m_editor.Init(this);
 }