Android Question Firebase Cloud Messaging Update Push Subscriptions

Alexander Stolte

Well-Known Member
Licensed User
Good Day,

if a device is first time using the FCM in a App, then he create an Instance ID, with this ID he can subscribe for topics or you can send a push message to this device with this ID. The problem is, Over time, you subscribe to a heap of topics and this ID is not forever this ID is lost if you:

FirebaseInstanceId
  • App deletes Instance ID
  • App is restored on a new device
  • User uninstalls/reinstall the app
  • User clears app data
and then you can't receive messages from these topics, because you have then a new Instance ID.

I found here maybe a solution, but i dont understand what is needed and if it is the right one.

My question is, is this the right one? and if yes how to configure it?

if not, what is an alternative, how can I save the subscribed topics?

This is a important question, because everyone is affected, I think that hardly anyone knows that the instance id is lost.

Greetings
 

Erel

Administrator
Staff member
Licensed User
This is a important question, because everyone is affected,
I don't think so. Most developers let Firebase handle the topics and don't use the token ids at all.

A possible solution is to always store the newest id and delete old ids after X days. If someone hasn't opened your app in 30 days then you should probably avoid sending them a message anyway.
 

Alexander Stolte

Well-Known Member
Licensed User
The Problem is, that the subscription is save on the Instance ID, if you have a new ID, then you dont follow these topics o_O
 

Erel

Administrator
Staff member
Licensed User
You should call subscribe whenever your app starts. This way the user will always be subscribed.
 

Erel

Administrator
Staff member
Licensed User
Have you tried it and seen a performance impact from subscribing to 100 topics?
 

Alexander Stolte

Well-Known Member
Licensed User
No, but I would have to give the whole topics as an argument to the script and that would be too long for an argument. I'm currently testing a script from firebase which I do not understand, but yesterday I did not have that much time.
 
Top