Is FCM (firebase cloud messaging) Token for one device or for one account?

10,336

Solution 1

The Instance ID token used to send FCM messages represents the instance of and app on a device. The current user of the app would not affect the token that represents the app instance. Uninstalling and reinstalling the app would cause a new token to be generated but not for in app behaviour like switching users.

You should still remove the mapping of the token to the user on logout and add a new mapping with the same token to the user that logs in but it will be the same token.

Solution 2

I probably feel this may help you,

When user logs out clear his device token and make him Logout so that he won't be able to receive the updates and hence only one user at a time can get the updates

Share:
10,336
Roshan Sharma
Author by

Roshan Sharma

Updated on June 19, 2022

Comments

  • Roshan Sharma
    Roshan Sharma almost 2 years

    I want to store FCM token in my android app user's table in database when user register to the app . When i want to send notification to specific user then i will fetch Token from corresponding row and send push notification.But i am confused that whenever app user logout from his app and register new account from same device ,then there will be two row and hence two Token for same device on database. How to handle such case? What happen to old Token in device? please anyone can help me??