onTokenRefresh

open fun onTokenRefresh(token: String)

Notifies Pushwoosh when Firebase Cloud Messaging token is refreshed.

CRITICAL: Call this method from your custom onNewToken callback to forward the new FCM token to Pushwoosh. Without this call Pushwoosh keeps the token it obtained at registration and silently stops reaching the device once Firebase rotates it.

The call is a no-op for a device that is not registered for push: a token change arriving before registerForPushNotifications succeeds, or after unregisterForPushNotifications, is dropped with a warning by design. Example:



public void onNewToken(@NonNull String token) {
    super.onNewToken(token);

    // CRITICAL: Forward token to Pushwoosh
    PushwooshFcmHelper.onTokenRefresh(token);
}

Parameters

token

new Firebase Cloud Messaging token

See also

FirebaseMessagingService#onNewToken(String)