How to the get FCM token for inactive users? [Flutter]

Viewed 52

I have the FCM token, and token refreshed when user is using the application. I want to send push notifications to users who have not logged into the app recently.

As the FCM token expires, how do I implement Firebase Messaging, and get the user FCM token when the app is not opened for days?

1 Answers

The token doesn't expire, it may change in the following cases.

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

To handle these cases the application should retrieve the current token at initial startup and send it to the server.

See Best practices for more information.

Related