How to configure Push notifications for iOS [Unity]

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

  1. Configure the required Apple certificates for push notifications in iOS 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. You can leave the Android Sender Id field empty.

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

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

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
            break;
        default:
            // Do nothing
            break;
    }
}

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