2

Recently, I integrated the Firebase Topic concept in my APP and near to 2K users was subscribed and I', triggering notifications daily via my app server.

What I want to know is how many users are getting delivered and failed. Because if some users are not getting delivered and failed, I'll set a retry of the notification to those members again. Any ideas about this?

I also tried the following URL via ARC (Advanced Rest Client) for getting the information about all my topics in my current project with following API:

https://iid.googleapis.com/iid/info/APA91bHQ3Jp2NPrVF7z_1a8qNgg_YGI-
zPhnxnpumCeckvieHACuwaIWPlaR....QcChUOhk4T62vAc_0PC8HVk4p4D?details=true

Content-Type: application/json
Authorization: key=<SERVER_KEY> 

SERVER_KEY -> ( Firebase Console -> Settings -> Cloude message -> Legacy Server key )

But I am getting the response status:

400: Bad Request
{
"error": "InvalidTokenVersion"
}

Any idea to resolve this issue?

AL.
  • 36,815
  • 10
  • 142
  • 281
Saikumar
  • 877
  • 1
  • 9
  • 22
  • I tested it out on my end. I also received the same `InvalidTokenVersion` when I used a token that started with `APA`. When I tested a token with a colon (`:`), it returned as expected. So now I'm fairly sure this has something to do with the registration token. – AL. Feb 24 '17 at 08:05
  • colon (:) means like this right?...https://iid.googleapis.com/iid/info/APA91b....:details=true – Saikumar Feb 24 '17 at 08:22
  • Nope. It has to be a part of the registration token. For example, my token in the old format is like this `APA91bG....sLI`. A token with a new format (with colon `:`) is like this `cEV....V4:APA91...l0k1GWMuA`. See the colon between the two strings? – AL. Feb 24 '17 at 08:27
  • Refer this url : https://drive.google.com/file/d/0B0g5_07sb2TxNVhla0NUbFRuNnM/view?usp=sharing – Saikumar Feb 24 '17 at 08:28
  • The colon is a part of the registration token. Not the request. Did you *re-generate* a token from the device? – AL. Feb 24 '17 at 08:45
  • I re-generated the device token again, its comes again start with "APA" without colon only... – Saikumar Feb 24 '17 at 09:00
  • Glad to see you made it work. Was the registration token format the cause of it, like I suspected it to be? – AL. Feb 24 '17 at 14:49
  • 1
    Problem is I creating the registration token using multiple senderid..like FirebaseInstanceId.getInstance().getToken(senderids, FirebaseMessaging.INSTANCE_ID_SCOPE).... If i am using like this, then i will get and start with Token id "APA".... Otherwise i am getting what you said like ":"... Now prefectly working... One more clarification.. how will create the registration token for multiple senderid – Saikumar Feb 25 '17 at 06:43
  • See my [answer here](http://stackoverflow.com/a/37981412/4625829). :) – AL. Feb 25 '17 at 08:54

1 Answers1

1

There is currently no available API that you can use in order to trace if a message has been received by the device when using Topics Messaging.

You'll have to implement your own way to somehow acknowledge that the message from the topic has been received by your client app, if it didn't receive it, then have your App Server do a retry.

On a side note, when using FCM, it is highly advised to make use of the Server Key instead of the Legacy Server Key.


With regards to the InvalidTokenVersion response. It seems that it is related to the registration token. I tried it out on my end and was able to replicate the response, but only when using a registration token with the old format (starts with APA with no colon ":").

But when I tested a token with the new format, it returned expected response. I'm fairly sure this has something to do with the registration token somehow.

AL.
  • 36,815
  • 10
  • 142
  • 281
  • Thanks. I tried Server Key, still i am getting the same error : "InvalidTokenVersion". – Saikumar Feb 24 '17 at 05:16
  • I refer this url http://stackoverflow.com/questions/37427709/firebase-messaging-where-to-get-server-key and used Current_Key from Google-Services.json and used and tried. I am getting error "401 Unauthorized"... – Saikumar Feb 24 '17 at 05:19
  • I see that the token you have has the old format (starts with `APA`). Could you try to generate a new token where it should show one that uses the new format (one with a colon `:`). – AL. Feb 24 '17 at 05:37
  • Also, you should just use the Server Key. 401 is caused by using an invalid Server API Key. See my [answer here](http://stackoverflow.com/a/37801206/4625829). – AL. Feb 24 '17 at 05:44
  • Were you able to try in generating a new registration token? – AL. Feb 24 '17 at 07:24
  • I tried the same process and generate new registration id for new devices and use the same url via ARC ( Advance Rest Client ) but the same error i am getting. – Saikumar Feb 24 '17 at 07:53
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/136553/discussion-between-user2488539-and-al). – Saikumar Feb 24 '17 at 14:38
  • 1
    Perfectly working after creating the New Register Token... Previously i am creating Token by using SenderId. So i am getting old one. like FirebaseInstanceId.getInstance().getToken(senderids, FirebaseMessaging.INSTANCE_ID_SCOPE) – Saikumar Feb 24 '17 at 14:40
  • @user2488539 Previously you were creating Token by using SenderId and now? – Don Jose Jan 04 '18 at 09:33