/// <summary> /// The callback that will be called from the Android Java land via <c>UnityPlayer.UnitySendMessage(string)</c> /// when the device receive a push notification. /// </summary> /// <param name="pushPayloadString">the push payload as string</param> internal void OnPushNotificationReceived(string pushPayloadString) { ParseInitializeBehaviour behavior = gameObject.GetComponent <ParseInitializeBehaviour>(); if (behavior != null) { behavior.Initialize(); } ParsePush.parsePushNotificationReceived.Invoke(ParseInstallation.CurrentInstallation, new ParsePushNotificationEventArgs(pushPayloadString)); }
public override void Awake() { //we use a few different URLs, but set CurrentURL and currentID to whatever you want HERE ParseInitializeBehaviour nativeParseScript = this.gameObject.AddComponent <ParseInitializeBehaviour>(); nativeParseScript.applicationID = "hrRpHQ7xt7LzCRJ48MxSgxxL"; nativeParseScript.dotnetKey = "4vB7L5zUTrOpPU8U94DX2XLe"; //.net key doesnt even matter in Parse Server nativeParseScript.serverURL = "http://45.32.255.165:1337/parse/"; ParseClient.Initialize(new ParseClient.Configuration() { WindowsKey = "4vB7L5zUTrOpPU8U94DX2XLe", //.net key doesnt even matter in Parse Server ApplicationId = "hrRpHQ7xt7LzCRJ48MxSgxxL", Server = "http://45.32.255.165:1337/parse/" }); Debug.Log("server is " + ParseClient.CurrentConfiguration.Server); //just checking }
public static void InitParse() { #if PARSE_PUSH_ENABLED GameObject parse = new GameObject("AN_ParsePushesStub"); ParseInitializeBehaviour parseInit = parse.AddComponent <ParseInitializeBehaviour>(); parseInit.applicationID = AndroidNativeSettings.Instance.ParseAppId; parseInit.dotnetKey = AndroidNativeSettings.Instance.DotNetKey; //parseInit.Awake(); ParsePush.ParsePushNotificationReceived += (sender, args) => { #if UNITY_ANDROID AndroidJavaClass parseUnityHelper = new AndroidJavaClass("com.parse.ParsePushUnityHelper"); AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject currentActivity = unityPlayer.GetStatic <AndroidJavaObject>("currentActivity"); // Call default behavior. parseUnityHelper.CallStatic("handleParsePushNotificationReceived", currentActivity, args.StringPayload); // Fire notification received callback OnPushReceived(args.StringPayload, args.Payload as Dictionary <string, object>); #endif }; #endif }