Push Notification¶
We provide an easy to use push notification support via our Scalable Server system which allows to be notified when it’s the player’s turn or when the player receives an invitation.
Setup¶
Prerequisites for Android¶
- Create an entry for your game in Firebase console (see step by step)
- Communicate your senderId and key to your Asmodee contact for Asmodee.net administrator
- Follow Firebase instructions for installing Firebase SDK (only the Android part) - We recommand to use the package manager version
- Add the compilation symbol ‘FIREBASE’ to your unity project
Prerequisites for iOS¶
- Be sure that your application is hosted by the Asmodee Apple Account and not yours
How to¶
- From the Unity package manager, install latest
Mobile Notifications
package - Go to Unity
Project Settings
, sectionMobile Notifications Settings
Android tab
- Check
use custom android activity
option, and addcom.google.firebase.MessagingUnityPlayerActivity
- Add 2 icons named
small_icon
andlarger_icon
which will be used as notification icon
iOS tab
- Check
Request Authorization on App Launch``and ``Enable Push Notification
- Check
Enable release environment for APS
if you plan to use release environment
You can choose between speak with Apple push server release or sandbox with the precompile definition PUSHNOTIFICATIONSANDBOX
With those steps, your application can now speak to our backend.
The SDK provides a configuration file to set the translation keys needed for push notifications texts.
This file called PushNotificationManagerData
(DO NOT RENAME IT) needs to be in an Editor
folder and can be created via menu Assets/Create/Asmodee.net/Create/PushNoificationManagerData
Keys translations come from our localization tool and will be added to native code after compilation.
If you need to have a custom Android Manifest, make sure to uncheck UpdateAndroidManifest in your PushNotificationManagerData
asset but be sure tu add our service to your manifest.
You can find our android manifest template in file UpdateValuePushNotificationAndroidPluginBuildProcessor.cs
For more technical details, see the Scalable Server documentation.
Use¶
From your game, when you receive a push notification, a ScalableServerNotification
notification will be send via the notification center so if you listen to this event since the app start
you will be notified.
iOS
You can pass to sandbox mode with the compilation symbol PUSHNOTIFICATIONSANDBOX
and Enable release environment for APS
set to off