Push notifications¶
This section allows you to manage server pushes.
You can schedule the sending of a push notification for a specific time and to a specific segment of players.
Be care with segment
Choose the player segment wisely to avoid accidentally sending a push notification to a group of players who should not receive it.
Requirements¶
- Update unity plugin to the last version.
- Send Firebase token to our server.
- You can do it in Firebase callback
Firebase.Messaging.FirebaseMessaging.TokenReceived += OnTokenReceived
:public void OnTokenReceived(object sender, Firebase.Messaging.TokenReceivedEventArgs token) { Balancy.LiveOps.Pushes.RegisterFirebaseToken(token.Token, data => {}); }
-
But sometimes this callback is called before you authorize in Balancy. So you can manually get and send token after the authorization:
Firebase.Messaging.FirebaseMessaging.GetTokenAsync().ContinueWithOnMainThread(res => { Balancy.LiveOps.Pushes.RegisterFirebaseToken(res.Result, data => {}); });
Use ContinueWithOnMainThread
It's important to use
ContinueWithOnMainThread
(instead ofContinueWith
) to make sure that function is called from the main Unity thread.
- You can do it in Firebase callback
Repeatable pushes¶
You can create a push notification that will be sent at a specified frequency. For example, every 12 hours.