예제 #1
0
        protected virtual void Update()
        {
            if (!tokenSent)
            {
                byte[] token = NotificationServices.deviceToken;
                if (token != null)
                {
                    hexToken = "%" + System.BitConverter.ToString(token).Replace('-', '%');
                    DevicePushIdReceived(hexToken);

                    tokenSent = true;
                }
            }

            if (NotificationServices.localNotificationCount > 0)
            {
                LocalNotificationReceived(NotificationServices.localNotifications [0].alertBody);
                NotificationServices.CancelLocalNotification(NotificationServices.localNotifications [0]);
                NotificationServices.ClearLocalNotifications();
            }

            if (NotificationServices.remoteNotificationCount > 0)
            {
                LocalNotificationReceived(NotificationServices.remoteNotifications [0].alertBody);
                NotificationServices.ClearRemoteNotifications();
            }
        }
예제 #2
0
        public override void ClearNotifications()
        {
            // Removing badge count
            NPBinding.Utility.SetApplicationIconBadgeNumber(0);

            // Clears notification
            NotificationServices.ClearLocalNotifications();
            NotificationServices.ClearRemoteNotifications();
        }
예제 #3
0
        IEnumerator CleanNotification()
        {
            #if UNITY_IPHONE
            UnityEngine.iOS.LocalNotification l = new UnityEngine.iOS.LocalNotification();
            l.applicationIconBadgeNumber = -1;
            l.hasAction = false;
            NotificationServices.PresentLocalNotificationNow(l);
            yield return(new WaitForSeconds(0.2f));

            RearrageBradeNum();
            NotificationServices.ClearLocalNotifications();
            #endif
        }
예제 #4
0
        void OnApplicationPause(bool pauseStatus)
        {
            if (Data == null)
            {
                return;
            }
            if (pauseStatus)
            {
                Time.timeScale = 0;
                #if UNITY_IOS
                NotificationServices.ClearLocalNotifications();
                NotificationServices.CancelAllLocalNotifications();
                ScheduleNotification();
                #endif

                PlayerPrefs.SetString("_gameCloseTime", System.DateTime.Now.ToString());
                Data.SetAchievementData(AchievementManager.GetAchievementKeeper());
                SaveLoadHelper.SaveGame(Data);
            }
            else
            {
                HandleDroppedMage();
                Time.timeScale = 1;
                #if UNITY_IOS
                //Debug.Log("Local notification count = " + NotificationServices.localNotificationCount);

                //if (NotificationServices.localNotificationCount > 0) {
                //    Debug.Log(NotificationServices.localNotifications[0].alertBody);
                //}

                // cancel all notifications first.
                NotificationServices.ClearLocalNotifications();
                NotificationServices.CancelAllLocalNotifications();
                #endif

                CalculateIdleIncomeAndShowNotification();
                StartCoroutine(WaveManager.SendWave());
            }
        }