1

I wonder what is the lifecycle of registrationId(device_token)

e.g eD3Fa1yVqx8:APA91bH5gNrC-jhUqaoRwyFLfD2ik4NXwCXohwhm_9CM5hnY9wFwUAOiO_O12Or-dm60sUqy9gN2ZW6mw5i90RyNhb-zHilvtcJczPjZoQlm_4lKNKDejC_1_xiqmYoZnSxaFfVqSA1d

How to handle the situation if it's changed?

Jenya Kirmiza
  • 385
  • 1
  • 3
  • 12
  • Possible duplicate of [Do GCM registration id's expire?](http://stackoverflow.com/questions/11590482/do-gcm-registration-ids-expire) – Muhammad Younas May 11 '16 at 08:42

2 Answers2

0

As far as the information on the official docs goes, there is no information about the token being changed by Google. However you should change it periodically.

Quoting https://developers.google.com/cloud-messaging/registration#automatic-retry-using-exponential-back-off

Keeping the Registration State in Sync

To protect the client app and app server from potential malicious re-use of registration tokens, you should periodically initiate token refresh from the server. When GCM registration token refresh is initiated from server side, the client app must handle a tokenRefreshed message with the GCM registration client/server handshake.

Pedro Oliveira
  • 20,442
  • 8
  • 55
  • 82
0

I faced some situations where Registration ID changed. But, i don't know how and when.

So, to handle these situations i updated my app to send Registration ID every time the app is launched. I sent Registration ID with device id and check my database if the registration id changed i updated it.

Ahmed M. Abed
  • 599
  • 3
  • 9
  • 22
  • good idea. What about saving for specific user the array of registrationIds? I mean, anyway specific user can have several devices, so i think he's gonna have several ids – Jenya Kirmiza May 11 '16 at 09:35
  • yes, if the user has more than one device he will take one registration id for each device. in my case, i replace old registration id with new one. – Ahmed M. Abed May 11 '16 at 09:44