Basic Configuration
To use Push Notification in your Unity application, you need to configure Firebase into your application; refer to the following documentation to configure Push Notification in your application.
In case your application is handling the push token registration and push payload, we highly recommend you use the native Android methods(mentioned in the documentation above) for passing the token and the payload to the SDK. If, for whatever reason, you wish to handle the token registration and handle incoming messages by yourself, pass the push token and payload to the SDK by using the below APIs
Also, make sure you have set up Firebase for Unity.
info |
Note NotificationConfig requires assets for small icon and large icon, depending your Unity version you will have to include these in either in Assets/res folder or include the raw assets in an Android Library Project or AAR. For more information on AAR, refer here. |
Passing Push Token
using MoEngage;
MoEngageClient.PassFcmPushToken()
Passing Push Payload
using MoEngage;
MoEngageClient.PassFcmPushPayload()
warning |
Warning We highly recommend you use the Android native APIs for passing the push payload to the MoEngage SDK instead of the Unity/C# APIs. Unity Engine might not get initialized if the application is in the killed state which will lead to poor push reachability or delivery. |
Customizing Push notification
If required the application can customize the behavior of notifications by using Native Android code (Java/Kotlin). To learn more about the customization refer to the Advanced Push Configuration documentation.Instead of extending PushMessageListener as mentioned in the above document extend PluginPushCallback.
Refer to the below documentation for Push Amp+, Push Templates, and Geofence.