Unity Push Notification Android Extra Data

0 votes

i'm working in a game and i need to send extra data to the game throw push notification, is there  a way to do this in Android? using Unity.

Thanks in advance.
asked May 8, 2015 in App42PaaS & BPaaS by jaime.franco (10 points)

1 Answer

0 votes

Hey Jaime, Yes, You can easily send extra data to game using Push Notification. You can find a complete tutorial of Push Notification integration on Unity Android game.

Let me know if it helps.


Vishnu Garg


answered May 9, 2015 by Vishnu Garg (674 points)
Im confused so as to which function to call from unity to send a JSON object in push notification. Can you please help with that?
You can use any of the function
Hi Vishnu,
I replaced the jar and the push notification displays what was passed in the "message" key but now the problem is how to retrieve the other data that was sent. Which callback will be fired for this data that is sent from Java to c#?
So what kind of other data you want to send from Android native to Unity. Currently you are getting the same Json in Unity side that you have sent using API in Unity. Can you share the Json format you are trying to send from one player to other and other player is not getting the full message in Unity.
I am simply trying to send a document id along with the message. The string for sending is created as below:
string message = "{" +
            "\"message\":\"New Game Request\",\"docId\":\""+ docId +"\"}";
        Debug.Log ("message is " + message);
        App42API.BuildPushNotificationService().SendPushMessageToUser(playerId,message,new Callback());

The onSuccess Function in Callback.cs which is a part of the Push Notification Plugin, gets called but it does not print any message on the log that is useful to me.
Also there is some issue when the user registers for Push Notifications on the device. The first time it registered with my Name which I dont understand where it got from as the user id was set to the fb id of the person. The next time i ran the app and tried sending the same push notification it gave an error stating that there was no user by that name. I logged into the Shephertz app and saw that the username had now changed to the FB Id that the user was registered with. Any idea why this is happening.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com