Skip to content

FcmTokenRefresher

Lejla Solak edited this page Sep 12, 2024 · 1 revision

FcmTokenRefresher is an Android service provided by the Infobip SDK designed to handle updates to Firebase Cloud Messaging (FCM) tokens. It ensures that any changes in the FCM token are automatically managed and updated in the Infobip WebRTC platform.

By declaring FcmTokenRefresher in your AndroidManifest.xml, you make Android aware that this service is available and should be used for handling FCM token updates.

<application>
    <service
            android:name="com.infobip.webrtc.sdk.impl.push.FcmTokenRefresher"
            android:exported="false"/>
</application>

The Android system recognizes that FcmTokenRefresher is registered as a service and invokes it whenever there is a change in the FCM token. This is done automatically by the FCM framework, which communicates with registered services.



onNewToken(newToken)

Description

This method is automatically called by the FCM framework whenever a new token is generated for the device.

The FcmTokenRefresher service automatically overrides the onNewToken method from FirebaseMessagingService to manage the new token. The Infobip SDK handles this process internally, forwarding the updated token to the Infobip WebRTC platform.

Note: You do not need to manually invoke onNewToken; it is automatically triggered by the FCM system when a new token is created.

Arguments

  • newToken: String - The new FCM token for the device.

Returns

  • N/A

Tutorials

Migration guides

Reference documentation

Clone this wiki locally