Server push notification, is the information delivery from a software application to a computing device without a specific request from the client. Different devices and services rely on different methods to deliver push notifications. One of the push notification services is Firebase Cloud Messaging (FCM). FCM is a free cloud service from Google that allows software developers to send push notifications for their applications to end users through an application programming interface (API). In order to use Push Notification you need to integrate the FCM Unity SDK into your project:
- Add a Firebase configuration file. The GoogleService-Info.plist file will be provided by the EazeGames integration support team.
- Add Firebase SDK
- Monitor token refresh. By default, the FCM SDK generates a registration token for the client app instance on app launch. Similar to the APNs device token, this token allows you to send targeted notifications to any particular instance of your app. FCM provides a registration token via event Firebase.Messaging.FirebaseMessaging.TokenReceived. In your own event listener attached to the first scene loaded bind acquired token to SDK:
public void Start() {
Firebase.Messaging.FirebaseMessaging.TokenReceived += OnTokenReceived;
}
public void OnTokenReceived(object sender,
Firebase.Messaging.TokenReceivedEventArgs token)
{
}
- Warning
- In order to use a Firebase analytics with provided code snippets uncomment the following row in GamePreparationManager.cs.
From now on device is able to receive Push Notifications and the EazeGamesSDK will handle them.