1

I made an app which was working fine until I found that after deleting and reinstalling the app it doesn't receive messages anymore that are sent to a a topic, although it does receive a message that is sent to the id-token of the app. Does anybody know what might be the problem? Firebase or my app?

Update: After clearing cache and data of the app it can receive notifications again. If reinstalled there's a chance of not working. I have to do some more testing, but I think it is solved by setting android:allowBackup="false" in the app manifest.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Dirk
  • 11
  • 1
  • 3

1 Answers1

2

After the uninstall and reinstall, your app on that device was assigned a new device token. According to that documentation:

The registration token may change when:

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

That new token won't have all the same subscriptions that the old one had. You'll have to re-subscribe to the topics that the user was interested in on that device.

It's not just reinstalls - your app should be ready to handle new tokens at any time, based on the criteria listed above. The linked documentation illustrates how to listen to token changes.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • 1
    The app doesn't receive messages after re-subscribing to the topics. – Dirk Oct 23 '19 at 16:10
  • Strange...after more than a day the app works again like it should on my phone. Could it be that it takes time for Firebase to invalidate and validate the device again? – Dirk Oct 23 '19 at 17:26