4

In our app we use Firebase Cloud Messaging to send push notifications to our users. We save the registration tokens of our users in our SQL database and when a user logs in or out we use the Firebase API to manage his topic subscriptions.

This works out pretty well in most of the cases but now the topic subscriptions return the following error for some of our registration tokens:

The provided registration token is not registered. A previously valid registration token can be unregistered for a variety of reasons. See the error documentation for more details. Remove this registration token and stop using it to send messages

In which cases does Firebase delete previously registered registration tokens? I can not find any specific information about this in the error documentation.

Thanks for your help!

Philipp Otto
  • 4,061
  • 2
  • 32
  • 49

1 Answers1

4

From the documentation:

A previously valid registration token can be unregistered for a variety of reasons, including:

  • The client app unregistered itself from FCM.
  • The client app was automatically unregistered. This can happen if the user uninstalls the application or, on iOS, if the APNS Feedback Service reported the APNS token as invalid.
  • The registration token expired. For example, Google might decide to refresh registration tokens or the APNS token may have expired for iOS devices.
  • The client app was updated, but the new version is not configured to receive messages.
Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • 1
    Hey Doug. Thank you very much for your answer which makes things pretty clear. Now we are wondering how we can handle the cases especially the second and the third one. How can we know that the token was invalidated to remove it from our database? Currently we want to batch add registration tokens to a topic which fails because of the invalid registration tokens. But as far as I know we never get to know when a user removed our app from his phone unless he installs it again. – Philipp Otto May 27 '18 at 12:25
  • That sounds like a separate question to ask. – Doug Stevenson May 27 '18 at 12:49