void Start() { #if UNITY_ANDROID Invoke("GetGCMToken", 5f); #endif #if UNITY_IOS #if ETCETERA EtceteraB.setBadgeCount(0); #endif this.CheckPushON(); #endif }
void RemotePushReceived(JsonObject obj) { #if UNITY_IOS #if ETCETERA EtceteraB.setBadgeCount(0); #endif UnityEngine.iOS.NotificationServices.ClearRemoteNotifications(); #endif //if (!Application.loadedLevelName.Equals ("MainMenu")) { if (SceneManager.GetActiveScene().name.StartsWith("MainMenu", System.StringComparison.OrdinalIgnoreCase)) { return; } MyDebug.Log("Push notification recevied, checking data"); if (obj != null) { //MyDebug.Log(Json.Serialize(obj)); if (obj.ContainsKey("action")) { JsonObject action = (JsonObject)obj["action"]; if (action.ContainsKey("type") && action.ContainsKey("method")) { string notiMethod = action["method"].ToString().ToLower(); switch (notiMethod) { case "challenge": case "response": break; } } else { MyDebug.Log("Push Notification has wrong data"); } } else { MyDebug.Log("Push Notification has not action information"); } } else { MyDebug.Log("Push Notification doesn't have any data"); } }