// Clears all notifications. public static void ClearAll() { NotificationServices.ClearRemoteNotifications(); #if !UNITY_EDITOR clearAll(); #endif }
void OnApplicationPause(bool pausing) { if (pausing) { } else { #if UNITY_4 foreach (var n in NotificationServices.remoteNotifications) { if (n.userInfo.Contains("notification_id")) { Native_ReceivedRemoteNotification(n.userInfo["notification_id"].ToString()); } } NotificationServices.ClearRemoteNotifications(); #else foreach (var n in UnityEngine.iOS.NotificationServices.remoteNotifications) { if (n.userInfo.Contains("notification_id")) { Native_ReceivedRemoteNotification(n.userInfo["notification_id"].ToString()); } } UnityEngine.iOS.NotificationServices.ClearRemoteNotifications(); #endif } }
void Update() { foreach (var notification in NotificationServices.remoteNotifications) { HandleMessage(notification.userInfo); } NotificationServices.ClearRemoteNotifications(); }
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); }
// Clears all notifications. public void ClearAll() { #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 NotificationServices.ClearRemoteNotifications(); #else UnityEngine.iOS.NotificationServices.ClearRemoteNotifications(); #endif #if !UNITY_EDITOR clearAll(); #endif }
void FixedUpdate() { if (NotificationServices.remoteNotificationCount > 0) { foreach (var rn in NotificationServices.remoteNotifications) { Debug.Log("Remote Noti: " + rn.alertBody); IOSNotificationController.instance.ShowNotificationBanner("", rn.alertBody); dispatch(REMOTE_NOTIFICATION_RECEIVED, rn); OnRemoteNotificationReceived(rn); } NotificationServices.ClearRemoteNotifications(); } }
internal static void TrackAppOpened(string _pushId) //(Android/iOS)-NCMBManager.onAnalyticsReceived-this.NCMBAnalytics { //ネイティブから取得したpushIdからリクエストヘッダを作成 if (_pushId != null && NCMBManager._token != null && NCMBSettings.UseAnalytics) { string deviceType = ""; if (SystemInfo.operatingSystem.IndexOf("Android") != -1) { deviceType = "android"; } else if (SystemInfo.operatingSystem.IndexOf("iPhone") != -1) { deviceType = "ios"; } //RESTリクエストデータ生成 Dictionary <string, object> requestData = new Dictionary <string, object> { { "pushId", _pushId }, { "deviceToken", NCMBManager._token }, { "deviceType", deviceType } }; var json = Json.Serialize(requestData); string url = CommonConstant.DOMAIN_URL + "/" + CommonConstant.API_VERSION + "/push/" + _pushId + "/openNumber"; ConnectType type = ConnectType.POST; string content = json.ToString(); NCMBDebug.Log("content:" + content); //ログを確認(通信前) NCMBDebug.Log("【url】:" + url + Environment.NewLine + "【type】:" + type + Environment.NewLine + "【content】:" + content); // 通信処理 NCMBConnection con = new NCMBConnection(url, type, content, NCMBUser._getCurrentSessionToken()); con.Connect(delegate(int statusCode, string responseData, NCMBException error) { try { NCMBDebug.Log("【StatusCode】:" + statusCode + Environment.NewLine + "【Error】:" + error + Environment.NewLine + "【ResponseData】:" + responseData); } catch (Exception e) { error = new NCMBException(e); } return; }); #if UNITY_IOS #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 NotificationServices.ClearRemoteNotifications(); #else UnityEngine.iOS.NotificationServices.ClearRemoteNotifications(); #endif #endif } }
void FixedUpdate() { if (NotificationServices.remoteNotificationCount > 0) { foreach (var rn in NotificationServices.remoteNotifications) { if (!IOSNativeSettings.Instance.DisablePluginLogs) { UnityEngine.Debug.Log("Remote Noti: " + rn.alertBody); } //IOSNotificationController.instance.ShowNotificationBanner("", rn.alertBody); OnRemoteNotificationReceived(rn); } NotificationServices.ClearRemoteNotifications(); } }
/// <summary> /// Processe remote notifications and clear them. /// </summary> public void ProcessRemoteNotifications() { if (config.PushNotificationEnabled) { // Process push notifications int notificationCount = NotificationServices.remoteNotificationCount; if (notificationCount > 0) { SwrveLog.Log("Got " + notificationCount + " remote notifications"); for (int i = 0; i < notificationCount; i++) { ProcessRemoteNotification(NotificationServices.remoteNotifications[i]); } NotificationServices.ClearRemoteNotifications(); } } }
public static void HandleTDGAPushMessage() { RemoteNotification[] notifications = NotificationServices.remoteNotifications; if (notifications != null) { NotificationServices.ClearRemoteNotifications(); foreach (RemoteNotification rn in notifications) { foreach (DictionaryEntry de in rn.userInfo) { if (de.Key.ToString().Equals("sign")) { string sign = de.Value.ToString(); _tdgaHandlePushMessage(sign); } } } } }
// 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(); } }
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(); }
private static List <Dictionary <string, object> > GetRemoteNotifications() { List <Dictionary <string, object> > result = new List <Dictionary <string, object> >(); if (NotificationServices.remoteNotificationCount > 0) { for (int r = 0; r < NotificationServices.remoteNotificationCount; r++) { RemoteNotification remoteNotification = NotificationServices.GetRemoteNotification(r); result.Add(new Dictionary <string, object>() { { "message", remoteNotification.alertBody }, { "payload", remoteNotification.userInfo } }); } NotificationServices.ClearRemoteNotifications(); if (GamedoniaPushNotifications.notificationType == RemoteNotificationType.Badge) { ClearBadge(); } } return(result); }
public static void ClearRemoteNotifications() { NotificationServices.ClearRemoteNotifications(); ApplicasaClearAllPushMessages(); }
//clear the notifications public void ClearNotifications() { NotificationServices.ClearLocalNotifications(); NotificationServices.ClearRemoteNotifications(); }