/** * Set CallBack GameObject on which get callback from native */ private static void setNativeCallbackListener() { if (mInstance == null) { GameObject receiverObject = new GameObject("App42Push"); DontDestroyOnLoad(receiverObject); mInstance = receiverObject.AddComponent <App42Push> (); setListenerGameObject(receiverObject.name); } }
public void onDeviceToken(String deviceToken) { message = "Device token from native: " + deviceToken; String deviceType = App42Push.getDeviceType(); if (deviceType != null && deviceToken != null && deviceToken.Length != 0) { App42API.BuildPushNotificationService().StoreDeviceToken(App42API.GetLoggedInUser(), deviceToken, deviceType, new Callback()); } }
public void Start() { DontDestroyOnLoad(transform.gameObject); App42API.Initialize(ApiKey, SecretKey); App42API.SetLoggedInUser(UserId); //Put Your Game Object Here App42Push.setApp42PushListener(this); #if UNITY_ANDROID App42Push.registerForPush(GoogleProjectNo); message = App42Push.getLastPushMessage(); #endif }