Is a FCM token reused?

Viewed 1209

Suppose a FCM token is generated abcd and assigned to a user say user 1 now this token is no longer associated to user 1 as he uninstalled his app. Can this token abcd be assigned to some other user in future?

EDIT 1:

I know it is unique at a time. But if a token is not being used by anyone abcd will that be used again by some other user as it is still unique as user 1 is using a different token?

EDIT 2:

The token I am referring to is the device regestration token.

2 Answers

The simple is NO

Google/Firebase practice is having a hashing algorithm to generate a long and non repeating id (usually associate with timestamp and other factors), which usually can be up to 20 characters or more, to ensure it is unique in the database (FCM device token db).

Therefore, it will always assign a new and unique token to the new device. Won't reuse the token in any circumstances.

[UPDATE]

Thanks for your comment, now I have a concrete answer to your problem now. Each token contains the particular user meta-data, and other info including unique id etc.

So the token can only be revoked by the same user but cannot be use by others (because it contains the user meta-data).

The documentation about GCM says that token is unique, I think the same applicable for FCM as well. https://developers.google.com/cloud-messaging/registration

To verify that they can send and receive messages, client apps must register with GCM. In this process, the client obtains a unique registration token...

Related