How to configure Push notifications for Android [Unity]

To get push notifications for Android, you need to follow these steps:

  1. Configure Google Cloud Messaging for Android and fill the correspondent fields in the Gamedonia Dashboard as described in this guide.

  2. Setup a Unity project with the Gamedonia SDK by following these steps.

  3. Add the GamedoniaPushNotifications Script (located at Assets/Plugins/Gamedonia) to your Gamedonia Prefab and set it up like this.

  4. Modify the AndroidManifest.xml (located at Assets/Plugins/Android) like this. Remember to put your bundle ID where it says your_package_name.

  5. Add this code to your Start() method:

//Handle push
GDPushService service = new GDPushService();
service.RegisterEvent += new RegisterEventHandler(OnNotification);

and this delegate to receive the notifications:

void OnNotification(Dictionary<string,object> notification) {
    Hashtable payload = notification["payload"] != null ? (Hashtable) notification["payload"] : new Hashtable();
    string type = payload.ContainsKey("type") ? payload["type"].ToString() : "";
    switch(type) {
        case "**type_of_the_notification**":
            //TODO: process the message
            // Do nothing

Now send a notification from the Composer. You should receive it in your device in the OnNotification delegate. Remember to test it in a device and not in the Unity editor, as it won't be able to receive push notifications.

More info here: Push notifications guide