Guide

How to Get the FCM Device Registration Token

Platform-specific guide to retrieving the FCM registration token from Android, iOS, and web apps for push notification testing.

Last updated: May 2026

Person using a smartphone — each device has a unique FCM registration token
Copy the token from your app logs and paste it into TestFCM

Android (Kotlin)

Ensure Firebase is initialized and google-services.json is in your app module. Request notification permission on Android 13+. Call FirebaseMessaging.getInstance().token.addOnCompleteListener and log the result.

Android smartphone on a desk for FCM push notification testing
Log the FCM token from Logcat and paste it into TestFCM
FirebaseMessaging.getInstance().token.addOnCompleteListener { task ->
  if (task.isSuccessful) {
    Log.d("FCM", "Token: ${task.result}")
  }
}

iOS (Swift)

Enable Push Notifications and Background Modes → Remote notifications in Xcode. Upload your APNs authentication key in Firebase Console. Call Messaging.messaging().token and print the token after permission is granted.

iPhone on a workspace used to test Apple Push Notification delivery via FCM
Physical iOS devices are recommended for reliable push testing

Web (JavaScript)

Initialize Firebase, request notification permission with Notification.requestPermission(), then use getToken(messaging, { vapidKey: "..." }) from firebase/messaging. The VAPID key is in Firebase Console → Cloud Messaging → Web configuration.

Token lifecycle

Tokens refresh when the app is restored on a new device, when the user clears app data, or when FCM invalidates a token. Subscribe to onNewToken (Android) or messaging(_:didReceiveRegistrationToken:) (iOS) to keep your backend updated.

Continue with our complete testing guide or open the FCM tester to send a notification now.

Ready to test? Open the FCM tester · Browse all guides

Guide photos from Unsplash & Pexels (free license)