0

I am trying to write test cases to validate whether canonical IDs successfully replaced the original token without mocking.

I am unable to reproduce this from an android device. I tried to send my push notification with old registration id , I am only getting NotRegistered from FCM.

Any suggestions as to how to reproduce?

Vijay Ram
  • 285
  • 2
  • 15
  • Does this answer your question ? https://stackoverflow.com/questions/27072824/how-to-get-canonical-id-from-gcm – anthonymonori Jul 10 '17 at 17:39
  • You get the Canonical ID back once you made a callback to their web service, hence I do not know how could you do that in a test environment without mocking – anthonymonori Jul 10 '17 at 17:40
  • Thanks for your comment.I think I read the SO question before. The SO answer or google does not tell when FCM/GCM thinks the ids are out of sync leading to canonical id generation. I am looking for any hack sort of solution so that i can test before pushing the code to production. – Vijay Ram Jul 10 '17 at 18:31

1 Answers1

1

AFAIK, you no longer have to expect working with Canonical IDs (although having your server/client to be able to handle them would be good). Ever since FCM came into play, I haven't seen Canonical IDs being used anymore.

A portion from my answer here:

In FCM, it seems the Canonical IDs are no longer used (or at the very least extremely rarely) because of how the Instance ID service works. To put it simply, the service works that there would only be one valid token per App Instance.

If the older token expires (for whichever reason), FCM triggers a tokenRefresh event where you would get a new registration token, and where you must also handle it accordingly (in onTokenRefresh()).

Community
  • 1
  • 1
AL.
  • 36,815
  • 10
  • 142
  • 281