0

await FirebaseMessaging.instance.getToken();

I used this code to get token but apparently this code just give me the token of the device, For example, if i uses many accounts in my app, i'll get the same token for every accounts. But if i use another device, i'll get different token.

nmzn
  • 1

4 Answers4

0

A firebase messaging token is tied to an installed App on a device, not to a particular user.

See: Firebase Cloud Messaging Auth Tokens vs Registration Token

What is the proper way to capture device registration tokens in order to send notifications via Firebase Cloud Messages?

Robbie
  • 1,291
  • 12
  • 10
0

The FCM token is generated based on the app , its bundle id and device thats why its unique for each devices for same app.

Hardik Mehta
  • 2,195
  • 1
  • 11
  • 14
0

Flutter firebaseMessaging Token is device specific.If you want to change your token then you can reinstall the app. If you want token based on user then you can use TokenRefresh method.

0

The token is generated per the client app instance.

On initial startup of your app, the FCM SDK generates a registration token for the client app instance.

See Best practices for FCM registration token management for details.

Only one user at the time is logged in on the app instance. Delete the token when a user logs out and then you get a new token when a new user logs in.

user18309290
  • 5,777
  • 2
  • 4
  • 22