When does a Google Cloud Messaging device group notification_key get deleted?

Viewed 143

The first thing I've found undocumented in the device group docs is that, if you delete the only registration ID inside of a device group, the notification_key for that device group becomes deleted.

Therefore, when managing my device group registrations, I have to keep track of registration IDs that I've registered in my app that uses GCM. This way, I know whether or not to 'create' a group or 'add' to a group depending on whether or not that group has at least 1 registration ID. You would think Google wouldn't impose this sort of behavior (why can't their API figure out whether to do an add or create operation), but it is what it is.

My question is, when else can a notification_key get deleted? One scenario I see would be a user on 1 device who gets a second GCM registration ID after > ~6 months of app usage. Let's say their GCM registration ID was 123abc when they first used the app, and now their GCM registration ID is 456xyz. If the user goes to logout, I will remove 456xyz from the device group. But do I have to bother removing 123abc from the device group? And if I don't, will the device group / notification_key remain active?

Another scenario would be if the user uninstalls the app and then comes back a few days later. When the app is uninstalled, the GCM registration ID that was added to the device group would be invalid - I believe they are unique across actual app installs. So is there any chance that the notification_key would be deleted before the user reinstalls the app and attempts to rejoin the presumed existing device group / `notification_key'?

0 Answers
Related