//---------------------------------------------------------------------------- // @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 }
void OnApplicationPause(bool paused) { if (paused) { Schedule(User.GetLifesManager.GetTimeWhenAllLifesWillRestored(), GameStrings.GetLocalizedString(GameStrings.LocalNotifications_AllLifesRestored), IdEvent_AllLifesRestored); DateTime date = DateTime.Now; date = date.AddDays(1); Schedule(date, GameStrings.GetLocalizedString(GameStrings.LocalNotifications_LaunchMe24Hours), IdEvent_RememberAfter24hours); date = date.AddDays(1); Schedule(date, GameStrings.GetLocalizedString(GameStrings.LocalNotifications_LaunchMe48Hours), IdEvent_RememberAfter48hours); date = date.AddDays(5); Schedule(date, GameStrings.GetLocalizedString(GameStrings.LocalNotifications_LaunchMe7Days), IdEvent_RememberAfter7Days); } else { LocalNotification setToZeroBadge = new LocalNotification(); setToZeroBadge.fireDate = System.DateTime.Now; setToZeroBadge.applicationIconBadgeNumber = -1000; setToZeroBadge.hasAction = true; NotificationServices.PresentLocalNotificationNow(setToZeroBadge); CancelAllEvents(); } }
//清空所有本地消息 static void IOS_CleanNotification() { LocalNotification l = new LocalNotification(); l.applicationIconBadgeNumber = -1; NotificationServices.PresentLocalNotificationNow(l); NotificationServices.CancelAllLocalNotifications(); NotificationServices.ClearLocalNotifications(); }
//清空所有本地消息 void CleanNotification() { #if UNITY_IOS || UNITY_IPHONE LocalNotification l = new LocalNotification(); l.applicationIconBadgeNumber = -1; NotificationServices.PresentLocalNotificationNow(l); NotificationServices.CancelAllLocalNotifications(); NotificationServices.ClearLocalNotifications(); #endif }
protected void ClearLocalNotifications() { LocalNotification localNotification = new LocalNotification(); localNotification.applicationIconBadgeNumber = -1; NotificationServices.PresentLocalNotificationNow(localNotification); NotificationServices.CancelAllLocalNotifications(); NotificationServices.ClearLocalNotifications(); EtceteraBinding.setBadgeCount(0); }
void DidExitRegion(object sender, CLLocationManager.DidExitEventArgs e) { var notif = new LocalNotification(); notif.alertBody = "Lost beacon!"; NotificationServices.PresentLocalNotificationNow(notif); Log("Left region."); locationManager.StopRangingBeaconsInRegion(beaconRegion); }
void DidEnterRegion(object sender, CLLocationManager.DidEnterEventArgs e) { var notif = new LocalNotification(); notif.alertBody = "Found beacon!"; NotificationServices.PresentLocalNotificationNow(notif); Log("Found beacon."); locationManager.StartRangingBeaconsInRegion(beaconRegion); }
/// <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 }
public override void PostLocalNotification(string title, string text, int id, IDictionary <string, string> userData, string notificationProfile, int badgeNumber, ICollection <Button> buttons) { if (!CheckInitialized()) { return; } if (m_enabled) { NotificationServices.PresentLocalNotificationNow(CreateLocalNotification(title, text, id, userData, notificationProfile, badgeNumber)); } }
//清空所有本地消息 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 }
/// <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 }
//清空所有本地消息 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 }
/// <summary> /// Pushs the local message. /// </summary> /// <param name="dtime">Dtime.</param> /// <param name="alertBody">Alert body.</param> /// <param name="alertAction">Alert action.</param> /// <param name="alertLaunchImage">Alert launch image.</param> /// <param name="applicationIconBadgeNumber">Application icon badge number.</param> /// <param name="soundName">Sound name.</param> /// <param name="userinfo">Userinfo.</param> public void PushLocalMsg(DateTime dtime, string alertBody, string alertAction = "", string alertLaunchImage = "", int applicationIconBadgeNumber = -1, string soundName = "", IDictionary userinfo = null ) { LocalNotification noti = new LocalNotification(); noti.alertBody = alertBody; noti.fireDate = dtime; if (alertAction != "") { noti.alertAction = alertAction; } if (alertLaunchImage != "") { noti.alertLaunchImage = alertLaunchImage; } if (applicationIconBadgeNumber != -1) { noti.applicationIconBadgeNumber = applicationIconBadgeNumber; } if (soundName != "") { noti.soundName = soundName; } if (userinfo != null) { noti.userInfo = userinfo; } if (dtime.Ticks == DateTime.Now.Ticks) { NotificationServices.PresentLocalNotificationNow(noti); } else { NotificationServices.ScheduleLocalNotification(noti); } }