Push Notifications

This guide walks you through setting up the Rover SDK in your app to enable push notifications.

Receive Firebase Push Token

Because Rover is avoiding directly calling the FCM library itself, you’ll need to pass a closure into NotificationsAssembler for requestPushToken to allow it to request the token from Firebase. It was already included in the Rover.initialize(…) example given in Getting Started, but it is repeated here for clarity:

    // ...,
    requestPushToken = { tokenFutureCallback ->
        FirebaseInstanceId.getInstance().instanceId.addOnCompleteListener { task ->

Firebase Message Receiver

The FCM library calls your Firebase Message Receiver with the incoming push notifications themselves. They need to be delivered to the Rover SDK so they can be populated into Android’s notification drawer and added to the Rover Notification Center. The FCM library may also call it with a new push token in the event of a remote update to the push token by Google.

Create a Firebase Message Receiver:

import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage
import io.rover.core.Rover
import io.rover.notifications.pushReceiver

class FirebaseMessageReceiver : FirebaseMessagingService() {
    override fun onMessageReceived(remoteMessage: RemoteMessage) {

    override fun onNewToken(newToken: String?) {

And add it to the application’s manifest:

<service android:name=".FirebaseMessageReceiver" android:exported="true">
        <action android:name="com.google.firebase.MESSAGING_EVENT"/>
         <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>