Ejemplo n.º 1
0
    //----------------------------------------------------------------------------
    //	@brief		ローカル通知のキャンセル
    //----------------------------------------------------------------------------
    public static void CancelAllNotifications()
    {
        if (Patcher.Instance.GetLocalNotificationCancelDisable())
        {
            return;
        }

#if LOCAL_NOTIFICATION_EDITOR
#if DEBUG_LOG
        // Editor
        Debug.Log("CancelAllNotification");
#endif
#elif LOCAL_NOTIFICATION_ANDROID
        // Android
        ELANManager.CancelAllNotifications();
#elif LOCAL_NOTIFICATION_IOS
        // iOS
        if (NotificationServices.localNotificationCount >= 0)
        {
            LocalNotification notification = new LocalNotification();
            if (notification != null)
            {
                notification.applicationIconBadgeNumber = -1;
                NotificationServices.PresentLocalNotificationNow(notification);

                NotificationServices.CancelAllLocalNotifications();
                NotificationServices.ClearLocalNotifications();
            }
        }
#endif
    }
Ejemplo n.º 2
0
    public void NotificationOnOff()
    {
        if (GameData.isMusicON)
        {
            MainDriver.Instance.PlayButtonSound();
        }
        if (GameData.isNotifcationON)
        {
            GameData.isNotifcationON = false;
            notificationText.text    = "OFF";
            notificationText.color   = offColor;
        }
        else
        {
            GameData.isNotifcationON = true;
            notificationText.text    = "ON";
            notificationText.color   = onColor;

                        #if UNITY_ANDROID
            EtceteraAndroid.cancelNotification(Constants.H4);
            EtceteraAndroid.cancelNotification(Constants.H8);
            EtceteraAndroid.cancelNotification(Constants.D1);
            EtceteraAndroid.cancelNotification(Constants.D3);
            EtceteraAndroid.cancelNotification(Constants.D7);
            EtceteraAndroid.cancelNotification(Constants.D14);
            EtceteraAndroid.cancelNotification(Constants.D30);
            EtceteraAndroid.cancelAllNotifications();
                        #elif UNITY_IOS
            NotificationServices.ClearLocalNotifications();
            NotificationServices.CancelAllLocalNotifications();
                        #endif
        }
        PlayerPrefs.SetBool(Constants.KEY_NOTIFICATIONS, GameData.isNotifcationON);
        PlayerPrefs.Flush();
    }
Ejemplo n.º 3
0
        /// <summary>
        /// Clears all of the created Local Notifications wherever they're showed or are still waiting to be triggered
        /// </summary>
        public static void ClearLocalNotifications()
        {
#if UNITY_IOS
            NotificationServices.ClearLocalNotifications();
            NotificationServices.CancelAllLocalNotifications();
#elif UNITY_ANDROID
#endif
        }
Ejemplo n.º 4
0
    //清空所有本地消息
    static void IOS_CleanNotification()
    {
        LocalNotification l = new LocalNotification();

        l.applicationIconBadgeNumber = -1;
        NotificationServices.PresentLocalNotificationNow(l);
        NotificationServices.CancelAllLocalNotifications();
        NotificationServices.ClearLocalNotifications();
    }
        protected void ClearLocalNotifications()
        {
            LocalNotification localNotification = new LocalNotification();

            localNotification.applicationIconBadgeNumber = -1;
            NotificationServices.PresentLocalNotificationNow(localNotification);
            NotificationServices.CancelAllLocalNotifications();
            NotificationServices.ClearLocalNotifications();
            EtceteraBinding.setBadgeCount(0);
        }
 //清空所有本地消息
 void CleanNotification()
 {
             #if UNITY_IOS || UNITY_IPHONE
     LocalNotification l = new LocalNotification();
     l.applicationIconBadgeNumber = -1;
     NotificationServices.PresentLocalNotificationNow(l);
     NotificationServices.CancelAllLocalNotifications();
     NotificationServices.ClearLocalNotifications();
             #endif
 }
Ejemplo n.º 7
0
    public override bool Initialize()
    {
#if UNITY_IPHONE
#if ENABLE_NOTIFICATION_LOG
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.AppendLine("[SysNotification]Initializing notification");
            sb.AppendFormat("Local notifications count : {0}", NotificationServices.localNotifications.Length);
            sb.AppendLine();
            foreach (var notif in NotificationServices.localNotifications)
            {
                sb.AppendFormat("\tNotification : {0}", Log(notif));
                sb.AppendLine();
            }

            sb.AppendLine();
            sb.AppendFormat("Scheduled local notifications count : {0}", NotificationServices.scheduledLocalNotifications.Length);
            sb.AppendLine();
            foreach (var notif in NotificationServices.scheduledLocalNotifications)
            {
                sb.AppendFormat("\tNotification : {0}", Log(notif));
                sb.AppendLine();
            }

            sb.AppendFormat("Remote notifications count : {0}", NotificationServices.remoteNotifications.Length);
            sb.AppendLine();
            foreach (var notif in NotificationServices.remoteNotifications)
            {
                sb.AppendFormat("\tNotification : {0}", Log(notif));
                sb.AppendLine();
            }

            Debug.Log(sb);
        }
#endif
        // Clear received local notification
//#if DISABLE_LOCAL_NOTIFICATION
        // notif.userInfo is not valid , clear all instead
        NotificationServices.CancelAllLocalNotifications();
//#endif
        NotificationServices.ClearLocalNotifications();

        // Clear received remote notification
        // Reset iphone app icon badge number, ClearLocalNotifications can not clear badge number.
        NotificationServices.ClearRemoteNotifications();
//		MessagePlugin.SetApplicationIconBadgeNumber(0);

        // Schedule login notification
        //		RescheduleAllLoginNotification();
#endif

        return(true);
    }
Ejemplo n.º 8
0
 /// <summary>
 /// Uklanja sve setovane  lokalne notifikacije (Samo IOS)
 /// </summary>
 public void CancelAllNotifications()
 {
             #if UNITY_IOS && !UNITY_EDITOR
     //Empty notification to clear badge number
     LocalNotification l = new LocalNotification();
     l.applicationIconBadgeNumber = -1;
     NotificationServices.PresentLocalNotificationNow(l);
     NotificationServices.CancelAllLocalNotifications();
     NotificationServices.ClearLocalNotifications();
     NotificationServices.ClearLocalNotifications();
             #endif
 }
Ejemplo n.º 9
0
    //清空所有本地消息
    void CleanNotification()
    {
#if UNITY_IPHONE
        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            LocalNotification l = new LocalNotification();
            l.applicationIconBadgeNumber = -1;
            NotificationServices.PresentLocalNotificationNow(l);
            NotificationServices.CancelAllLocalNotifications();
            NotificationServices.ClearLocalNotifications();
        }
#endif
    }
Ejemplo n.º 10
0
    /// <summary>
    /// 清空所有本地消息
    /// </summary>
    internal void CleanNotification()
    {
#if UNITY_IPHONE || NEW_EGSDK_IOS
        UnityEngine.LocalNotification l = new UnityEngine.LocalNotification();
        l.applicationIconBadgeNumber = -1;
        NotificationServices.PresentLocalNotificationNow(l);
        NotificationServices.CancelAllLocalNotifications();
        NotificationServices.ClearLocalNotifications();
#endif

#if UNITY_ANDROID || NEW_EGSDK_ANDROID
        // AndroidLocalNotification.CancelNotification(1);
        // AndroidLocalNotification.CancelNotification(2);
        AndroidLocalNotification.CancelAllNotifications();
#endif
    }
Ejemplo n.º 11
0
    void OnApplicationPause(bool pauseStatus)
    {
        if (pauseStatus)
        {
            Main.Instance.isLeaderBoard = false;
            {
                                #if UNITY_ANDROID
                Main.Instance._fourHrNotificationId = EtceteraAndroid.scheduleNotification(Main.Instance.fourHr, "Egg Drop", Main.Instance.msg_h4, "Egg Drop", "four-hour-note", "small_icon", "large_icon", Constants.H4);
//				Main.Instance._eightHrNotificationId = EtceteraAndroid.scheduleNotification( Main.Instance.eightHr, "Egg Drop", Main.Instance.msg_h8, "Egg Drop", "eight-hour-note", "small_icon", "large_icon", Constants.H8 );
                Main.Instance._oneDayNotificationId      = EtceteraAndroid.scheduleNotification(Main.Instance.oneDay, "Egg Drop", Main.Instance.msg_d1, "Egg Drop", "one-day-note", "small_icon", "large_icon", Constants.D1);
                Main.Instance._threeDayNotificationId    = EtceteraAndroid.scheduleNotification(Main.Instance.threeDay, "Egg Drop", Main.Instance.msg_d3, "Egg Drop", "three-day-note", "small_icon", "large_icon", Constants.D3);
                Main.Instance._sevenDayNotificationId    = EtceteraAndroid.scheduleNotification(Main.Instance.sevenDay, "Egg Drop", Main.Instance.msg_d7, "Egg Drop", "seven-day-note", "small_icon", "large_icon", Constants.D7);
                Main.Instance._fourteenDayNotificationId = EtceteraAndroid.scheduleNotification(Main.Instance.fourteenDay, "Egg Drop", Main.Instance.msg_d14, "Egg Drop", "fourteen-day-note", "small_icon", "large_icon", Constants.D14);
                Main.Instance._thirtyDayNotificationId   = EtceteraAndroid.scheduleNotification(Main.Instance.thirtyDay, "Egg Drop", Main.Instance.msg_d30, "Egg Drop", "thirty-day-note", "small_icon", "large_icon", Constants.D30);
                                #elif UNITY_IOS
                UnityEngine.iOS.NotificationServices.ScheduleLocalNotification(getNotification(Main.Instance.msg_h4, 4));
                UnityEngine.iOS.NotificationServices.ScheduleLocalNotification(getNotification(Main.Instance.msg_h8, 8));
                UnityEngine.iOS.NotificationServices.ScheduleLocalNotification(getNotification(Main.Instance.msg_d1, 24));
                UnityEngine.iOS.NotificationServices.ScheduleLocalNotification(getNotification(Main.Instance.msg_d3, 72));
                UnityEngine.iOS.NotificationServices.ScheduleLocalNotification(getNotification(Main.Instance.msg_d7, 168));
                UnityEngine.iOS.NotificationServices.ScheduleLocalNotification(getNotification(Main.Instance.msg_d14, 336));
                UnityEngine.iOS.NotificationServices.ScheduleLocalNotification(getNotification(Main.Instance.msg_d30, 720));
                                #endif
            }
        }
        else
        {
                        #if UNITY_ANDROID
            EtceteraAndroid.cancelNotification(Constants.H4);
            EtceteraAndroid.cancelNotification(Constants.H8);
            EtceteraAndroid.cancelNotification(Constants.D1);
            EtceteraAndroid.cancelNotification(Constants.D3);
            EtceteraAndroid.cancelNotification(Constants.D7);
            EtceteraAndroid.cancelNotification(Constants.D14);
            EtceteraAndroid.cancelNotification(Constants.D30);
            //			EtceteraAndroid.cancelAllNotifications();
                        #elif UNITY_IOS
            NotificationServices.ClearLocalNotifications();
            NotificationServices.CancelAllLocalNotifications();
                        #endif
        }

        Main.Instance.isLeaderBoard = false;
    }
Ejemplo n.º 12
0
 //清空所有本地消息
 void CleanNotification()
 {
             #if UNITY_EDITOR
             #else
                     #if UNITY_ANDROID
     if (InitNotificator())
     {
         m_ANObj.CallStatic("ClearNotification");
         //this.Text_Message.text = "Notification has been cleaned";
     }
                     #endif
                     #if UNITY_IPHONE
     LocalNotification l = new LocalNotification();
     l.applicationIconBadgeNumber = -1;
     NotificationServices.PresentLocalNotificationNow(l);
     NotificationServices.CancelAllLocalNotifications();
     NotificationServices.ClearLocalNotifications();
                     #endif
             #endif
 }
Ejemplo n.º 13
0
 // Update is called once per frame
 void Update()
 {
     if (NotificationServices.localNotificationCount > 0)
     {
         LocalNotification noti = NotificationServices.localNotifications[NotificationServices.localNotificationCount - 1];
         if (MsgAction != null)
         {
             MsgAction(noti.userInfo);
         }
         NotificationServices.ClearLocalNotifications();
     }
     if (NotificationServices.remoteNotificationCount > 0)
     {
         RemoteNotification noti = NotificationServices.remoteNotifications[NotificationServices.remoteNotificationCount - 1];
         if (MsgAction != null)
         {
             MsgAction(noti.userInfo);
         }
         NotificationServices.ClearRemoteNotifications();
     }
 }
Ejemplo n.º 14
0
        public override void HideAllNotifications()
        {
            if (!CheckInitialized())
            {
                return;
            }

            if (NotificationServices.localNotifications != null)
            {
                foreach (var notification in NotificationServices.localNotifications)
                {
                    HideNotification(notification);
                }
                NotificationServices.ClearLocalNotifications();
            }

            if (NotificationServices.remoteNotificationCount > 0)
            {
                NotificationServices.ClearRemoteNotifications();
            }

            _UT_HideAllNotifications();
        }
Ejemplo n.º 15
0
    public static void CancelAllEvents()
    {
        NotificationServices.CancelAllLocalNotifications();
        NotificationServices.ClearLocalNotifications();

        //удаляем те ивенты время которых истекло
        bool     isFound = false;
        DateTime nowDate = DateTime.Now;

        do
        {
            isFound = false;
            foreach (LocalNotificationDesc desc in mInstance._allEvents)
            {
                if (desc.fireDate < nowDate)
                {
                    mInstance._allEvents.Remove(desc);
                    isFound = true;
                    break;
                }
            }
        } while (isFound);
    }
Ejemplo n.º 16
0
 public void iOSCleanAll()
 {
     NotificationServices.CancelAllLocalNotifications();
     NotificationServices.ClearLocalNotifications();
 }
Ejemplo n.º 17
0
 public override void ClearNotifications()
 {
     NotificationServices.CancelAllLocalNotifications();
     NotificationServices.ClearLocalNotifications();
 }
Ejemplo n.º 18
0
 //clear the notifications
 public void ClearNotifications()
 {
     NotificationServices.ClearLocalNotifications();
     NotificationServices.ClearRemoteNotifications();
 }
Ejemplo n.º 19
0
 void ClearRecentDataIfNeed()
 {
     NotificationServices.ClearLocalNotifications();
 }