2

When do orphaned GCM Registration IDs expire?

Steps to reproduce:

  1. gcm.register(gcmSenderId) and receive a Registration ID
  2. Verify receipt of push notifications
  3. Factory Reset
  4. gcm.register(gcmSenderId) and receive a Registration ID
  5. Verify receipt of push notifications

Now, however, you can still send to the old Registration ID and receive "success:1". When, if ever, does that Registration ID expire and under what circumstances?

Bill Mote
  • 12,644
  • 7
  • 58
  • 82

2 Answers2

0

here you can find a good explanation

EDIT

summarized:

  • there is no expiration time defined by GCM server
  • you tell the GCM server when the reg ID expires
  • if you do not tell the GCM Server about the expiration, it will not expire, even if the app was uninstalled on the respective device
  • google reserves the right to update the IDs, but there is no "rule", google may (but not necessarily does) update it at any time, but if so, you will be informed by receiving a canonical_id
Community
  • 1
  • 1
rickul
  • 1,054
  • 1
  • 9
  • 15
  • That does not answer my question. That answer has speculation and guesses and does not address an orphaned ID as described above. In the use case described above there is no way to make a correlation between the previous and new Registration ID so canonical IDs are irrelevant. – Bill Mote Jun 05 '15 at 12:51
  • Are you saying a canonical ID is not provided to you when you use the old ID ? – Deepak Bala Jun 05 '15 at 12:53
  • canonical_ids:0 (or whatever the key is). The device gets a new unique ID after a factory reset -- and can even get one during an OS upgrade. – Bill Mote Jun 05 '15 at 12:56
0

Registration ID generate using this Instance ID API

The client app obtains registration token using the Instance ID API. for more description here

Registration ID expire and under the Instance ID lifecycle

your app or the Instance ID service may need to refresh tokens in the event of a security issue or when a user uninstalls and reinstalls your app during device restoration. Your app must implement a listener to respond to token refresh requests from the Instance ID service.

Furqan
  • 1,417
  • 1
  • 15
  • 22
  • Great info. Does not address Registration ID expiration. – Bill Mote Jun 05 '15 at 13:31
  • if you want to stop receiving messages just [unregister](https://developers.google.com/cloud-messaging/registration#unregistration-and-unsubscription) it – Furqan Jun 05 '15 at 13:46
  • And how would I do that if the ID is updated due to the user performing a factory reset? ;) See use case in question. – Bill Mote Jun 05 '15 at 13:53
  • Usually you have an app server with a db to store the IDs. This app server should decide if and when the IDs expire and unregister the expired ones at GCM server. – rickul Jun 05 '15 at 14:04
  • You get the user IMEI and update your record using IMEI in server side db – Furqan Jun 05 '15 at 14:10