diff --git a/src/pages/docs/push/getting-started/fcm.mdx b/src/pages/docs/push/getting-started/fcm.mdx index 237d572f9c..72c13328c4 100644 --- a/src/pages/docs/push/getting-started/fcm.mdx +++ b/src/pages/docs/push/getting-started/fcm.mdx @@ -169,6 +169,7 @@ import android.util.Log import androidx.core.app.NotificationCompat import com.google.firebase.messaging.FirebaseMessagingService import com.google.firebase.messaging.RemoteMessage +import io.ably.lib.types.RegistrationToken class PushNotificationService : FirebaseMessagingService() { @@ -180,9 +181,9 @@ class PushNotificationService : FirebaseMessagingService() { override fun onNewToken(token: String) { super.onNewToken(token) Log.d(TAG, "New FCM token received") - // Re-activate push with Ably whenever the FCM token is refreshed try { - AblyHelper.getInstance().push.activate() + // Update the FCM token on Ably server + AblyHelper.getInstance().push.getActivationContext().onNewRegistrationToken(RegistrationToken.Type.FCM, token) } catch (e: Exception) { Log.e(TAG, "Error updating FCM token with Ably", e) }