IEnumerator IEClearAfterAFrame() { yield return(0); NCMBPush push = new NCMBPush(); push.ClearAll(); }
void Update() { if (NotificationServices.remoteNotificationCount > 0) { ProcessNotification(); NCMBPush.ClearAll(); } }
void Update() { if (UnityEngine.iOS.NotificationServices.remoteNotificationCount > 0) { ProcessNotification(); NCMBPush push = new NCMBPush(); push.ClearAll(); } }
void Update() { #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 if (NotificationServices.remoteNotificationCount > 0) { #else if (UnityEngine.iOS.NotificationServices.remoteNotificationCount > 0) { #endif ProcessNotification(); NCMBPush push = new NCMBPush(); push.ClearAll(); } } void ProcessNotification() { // Payload data dictionary #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 IDictionary dd = NotificationServices.remoteNotifications [0].userInfo; #else IDictionary dd = UnityEngine.iOS.NotificationServices.remoteNotifications [0].userInfo; #endif // Payload key list string[] kl = new string[] { "com.nifty.PushId", "com.nifty.Data", "com.nifty.Title", "com.nifty.Message", "com.nifty.Channel", "com.nifty.Dialog", "com.nifty.RichUrl", }; // Payload value list string[] vl = new string[kl.Length]; // Index of com.nifty.Message int im = 0; // Loop list for (int i = 0; i < kl.Length; i++) { // Get value by key, return empty string if not exist vl [i] = (dd.Contains(kl [i])) ? dd [kl [i]].ToString() : string.Empty; // Find index of com.nifty.message im = (kl [i] == "com.nifty.Message") ? i : im; } // Set message as alertBody if (string.IsNullOrEmpty(vl [im])) { #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 vl [im] = NotificationServices.remoteNotifications [0].alertBody; #else vl [im] = UnityEngine.iOS.NotificationServices.remoteNotifications [0].alertBody; #endif } // Create payload #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 NCMBPushPayload pl = new NCMBPushPayload(vl [0], vl [1], vl [2], vl [3], vl [4], vl [5], vl [6], NotificationServices.remoteNotifications [0].userInfo); #else NCMBPushPayload pl = new NCMBPushPayload(vl [0], vl [1], vl [2], vl [3], vl [4], vl [5], vl [6], UnityEngine.iOS.NotificationServices.remoteNotifications [0].userInfo); #endif // Notify if (onNotificationReceived != null) { onNotificationReceived(pl); } } void OnApplicationPause(bool pause) { if (!pause) { ClearAfterOneFrame(); } } void ClearAfterOneFrame() { StartCoroutine(IEClearAfterAFrame()); } IEnumerator IEClearAfterAFrame() { yield return(0); NCMBPush push = new NCMBPush(); push.ClearAll(); }
void Update () { #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 if (NotificationServices.remoteNotificationCount > 0) { #else if (UnityEngine.iOS.NotificationServices.remoteNotificationCount > 0) { #endif ProcessNotification (); NCMBPush push = new NCMBPush (); push.ClearAll (); } } void ProcessNotification () { // Payload data dictionary #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 IDictionary dd = NotificationServices.remoteNotifications [0].userInfo; #else IDictionary dd = UnityEngine.iOS.NotificationServices.remoteNotifications [0].userInfo; #endif // Payload key list string[] kl = new string[] { "com.nifty.PushId", "com.nifty.Data", "com.nifty.Title", "com.nifty.Message", "com.nifty.Channel", "com.nifty.Dialog", "com.nifty.RichUrl", }; // Payload value list string[] vl = new string[kl.Length]; // Index of com.nifty.Message int im = 0; // Loop list for (int i = 0; i < kl.Length; i++) { // Get value by key, return empty string if not exist vl [i] = (dd.Contains (kl [i])) ? dd [kl [i]].ToString () : string.Empty; // Find index of com.nifty.message im = (kl [i] == "com.nifty.Message") ? i : im; } // Set message as alertBody if (string.IsNullOrEmpty (vl [im])) { #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 vl [im] = NotificationServices.remoteNotifications [0].alertBody; #else vl [im] = UnityEngine.iOS.NotificationServices.remoteNotifications [0].alertBody; #endif } // Create payload #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 NCMBPushPayload pl = new NCMBPushPayload (vl [0], vl [1], vl [2], vl [3], vl [4], vl [5], vl [6], NotificationServices.remoteNotifications [0].userInfo); #else NCMBPushPayload pl = new NCMBPushPayload (vl [0], vl [1], vl [2], vl [3], vl [4], vl [5], vl [6], UnityEngine.iOS.NotificationServices.remoteNotifications [0].userInfo); #endif // Notify if (onNotificationReceived != null) { onNotificationReceived (pl); } } void OnApplicationPause (bool pause) { if (!pause) { ClearAfterOneFrame (); } } void ClearAfterOneFrame () { StartCoroutine (IEClearAfterAFrame ()); } IEnumerator IEClearAfterAFrame () { yield return 0; NCMBPush push = new NCMBPush (); push.ClearAll (); }