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(); } }
public override void ClearNotifications() { // Removing badge count NPBinding.Utility.SetApplicationIconBadgeNumber(0); // Clears notification NotificationServices.ClearLocalNotifications(); NotificationServices.ClearRemoteNotifications(); }
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 }
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()); } }