Home > Software design >  FCM token update- flutter
FCM token update- flutter

Time:01-18

For fcm (Firebase Could messaging), We get a token using getToken()

I want to know,

Is the token generate one time or Is the token generate every time user login?

CodePudding user response:

The registration token may change when:

  • The app is restored on a new device
  • The user uninstalls/reinstall the app
  • The user clears app data.

More :

  • Update from Play Store - Token remains same.
  • When close the application and reopen it - Token remains same.

If you want to call onTokenRefreshed() you should do it manually.

Learn more - https://firebase.google.com/docs/cloud-messaging/android/client


Additionally,

I recommend you should record that token for the user every time your app launches. Then, you don't face any problems.

CodePudding user response:

In Flutter, when you use the Firebase Cloud Messaging (FCM) plugin, the FCM token is generated every time the app is installed or when the user logs in to the app. The token is unique for each device and is used to identify the device when sending push notifications. The token can change if the app is uninstalled, reinstalled, or if the user clears app data. It is recommended to periodically check for a new token and update your server with the new token. Reference; Docs

  • Related