How can I detect when the user clicks on a push notification using Unity?

0 votes

I'm using the Unity App42 plugins for Android and iOS and I have successfully subscribed the device to App42 and to channels and I receive push notifications correctly.

Now I'm trying to detect when user has opened the app by clicking a push notification and get the notification message so I can keep track of it. How can I do that on iOS and Android using Unity?


asked Apr 1, 2014 in App42 Cloud API-BaaS by contact (10 points)

2 Answers

0 votes


For iOS PlugIn : When you click on the notification "onPushNotificationsReceived" method will be called in the PushScript .cs class in the iOS plugin sample.

For Android: If you are using sample and not changing callBackMethod name then Success(message) will be called.In case you are using your own method as a callBack then that method is called as specified in ReadME file.

In that methods, you can call tracking methods. For tracking APIs, you can find more here.


answered Apr 1, 2014 by rajeev.etc (1,517 points)
0 votes

You have to put following snippet when your app gets opened after clicking on Push Notification.


ServiceAPI serviceAPI = new ServiceAPI(“YOUR API KEY”,”Your SECRET Key”);

serviceAPI.BuildLogService().SetEvent("Message", "Opened", new UnityCallbackClass()); // Unitycallback class is your callback class for App42

This will track the message and should be able to see it in dashboard under push notification graph.



answered Apr 2, 2014 by ajay123 (899 points)
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