Android Question Firebase Cloud Messaging Update Push Subscriptions

Discussion in 'Android Questions' started by Alexander Stolte, Jan 29, 2018.

  1. Alexander Stolte

    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:

    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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    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.
     
  3. Alexander Stolte

    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
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    You should call subscribe whenever your app starts. This way the user will always be subscribed.
     
  5. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    This will be difficult and would be unnecessary traffic for a social app if a user has subscribed to several 100 topics in his time.
    There has to be another way.
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Have you tried it and seen a performance impact from subscribing to 100 topics?
     
  7. Alexander Stolte

    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.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice