I would like to show delta dna push notifications in my game, for android and ios.
My game is made with Unity. I have already read the entire integration tutorial (http://docs.deltadna.com/advanced-integration/unity-sdk/), but some aspects are not crear yet for me:
Where, in my code, I will receive a push notification? There is an event/delegate? I didnt found it.
How can I receive push notifications while my game is closed? Running in background?
We have a demo online that shows you how to do this in android, the unity SDK example also shows this for iOS.
You can find the code here: https://github.com/deltaDNA/UnityNotificationDemo
Basically the code for handling the received GCM message only lives within the android code.
Android will receive the GCM message and start the service, this will then execute some code that in this case shows a notification but could also do something instead of showing a notification.
Ok, I checked out the examples.
It is still not clear for me how I will achieve this: "execute some code that in this case shows a notification but could also do something instead "
I must write a native plugin? For both Android and iOS?
I need to show the notification, but also make my game react to this notification, like, player received an item, then when he plays the game, I need to give him the item.
You don't have two write the android and ios plugin yourself, but you will need to have that code in there. We have the plugins as part of our sdk. The downside of this is that if you want to do something with the message you receive you will have to write something yourself, our sdk will only show a notification based on the message you send from the platform.
Under the hood Android will receive a GCM message and the code that is then executed will show a notification but if you want to write it yourself it could also do other things, for iOS this works slightly different since iOS does have a dedicated push notification system.
I imagine you want to have code in unity that deals with a rewarded item and you also want to show a push notification for that? If that's the case then you can use an engage campaign to reward the item to a segment and also send a notification to the same segment. If you want to react upon the received notification you will have to write a plugin for Android and iOS.
I hope this clears things up.
I am currently looking into the same aspect. Sending a key to users and when they open the game from push notification or are already in-game to do something with the key. (Also using Unity)
So far I'm unable to have the native bridge even notice a push notification has been sent. From the code I also noticed that on the github ( https://github.com/deltaDNA/UnityNotificationDemo/tree/master/Assets/DeltaDNA/Notifications ) project Android doesn't even have a bridge to listen when push notification is received. Would it be possible to have a more technical resolution to this?
It possible to recive delta DNA push notification after same time sending by app?
Hi - I'm having trouble getting push notifications to work on my Android app, made in Unity.
DDNANotifications.Register crashes with no debug output when it's called. I suspect that this may be a manifest problem but I'm struggling to find what's wrong. As far as I can see, I've followed your documentation correctly.
I'd like to look at your Unity example, but https://github.com/deltaDNA/UnityNotificationDemo just 404's. Has this moved? Is there any chance that I can get a functioning Unity example so I can try to see what's gone wrong with my app?
Thanks very much!
We by now have implemented push notifications in a generic way that does not require you to write your own listener services anymore. This is why I removed the example project where we explain how to do this.
Implementing push notifications is covered in the documentation on github:
If you would like an example project where I've implemented push notifications you can have a look here: https://github.com/StevenStip/unityNotificationsDemo
That project is just a simple Unity project but it does include a full working manifest file with custom notification icons and it has implemented the callbacks.
These callbacks can be used to look into the original message that was received upon opening the notification so you can do something like reward the player with a bonus.
I hope this answers your questions.