Firebase: Difference between Firebase InstallationID and fcmToken

Viewed 499

Is InstallationID and fcmToken or token different or the same in Firebase. If they are different then how?

It is not clearly explained in the migration guide how they are different. It does mention though that how InstanceID is different from InstallationsID

It is mentioned in their docs about the token that

This creates a Firebase Installations ID, if one does not exist, and sends information about the application and the device to the Firebase backend. A network connection is required for the method to succeed.

This is even more confusing if someone is using the token API to register the token and then migration guide say we have to replace it with

Installations.installations().installationID { (id, error) in
  if let error = error {
    print("Error fetching id: \(error)")
    return
  }
  guard let id = id else { return }
  print("Installation ID: \(id)")
}
1 Answers

To summarize, the installation ID is used within the device and as a self-reference so the app is able to distinguish itself from others. as multiple apps could be using firebase as their main app driver.

The FCM token is a token generated for the device, also used to identify the device in question but is used to identify the device in the notification network rather than internally amongst other apps.

Both are used in similar ways to identify the device and the app but are ultimately for different purposes. If you are dealing with Firebase Messaging, you will need to reference the FCM token.

Related