- Home /
Finding out if a user entered the game from notification (iOS/Android)
Hey, I was wondering how I can tell if a user came into my game through a local/remote push notification (both on Android and on iOS) - I looked around the internet and couldn't find anything on doing this specifically on Unity.
Thanks!
Answer by praveee · Aug 25, 2014 at 10:52 AM
Are you working on a multiplayer game? if you are using unity multiplayer just use
void OnConnectedToServer()
{
//Player connected do stuffs
}
or if you are using Photon cloud (photon unity networking)
public void OnPhotonPlayerConnected(PhotonPlayer player)
{
// Player connected do stuffs here
}
here is good unity networking tutorial
Hey Praveee, thank you for the reply - however if you'll reread my post, I'm asking about finding out if a player came into the game from clicking on a local/remote push notification
Hey ur question is not specific. To whom do u want to tell? do u want to how many user is playing ur game.?? Be specific write in details... Thanks
Answer by Rhynooo · Nov 07, 2014 at 08:00 AM
For iOS you can search here : http://docs.unity3d.com/ScriptReference/NotificationServices.html
For Android it seems that Unity doesn't integrate push notification natively, but you can easily write a plugin (in Java (Android SDK) or C++ (NDK)) for your application that you will call in your Unity Scripts. Here is a guide for writing plugins : http://docs.unity3d.com/Manual/PluginsForAndroid.html