Bastel
Bastel

Reputation: 52

Canonical IDs for iOS notifications over GCM

We have a server to send notifications to our users on iOS and Android. Android works fine.

The problem is, when an user uninstalls and reinstalls our app. The app then requests a new push ID from GCM with its APNS ID(which is still the same) and sends us the new ID. Now we have 2 records to send notifications to. It looks like GCM just maps its generated ID to APNS ID in a simple N:1 relation.

If we had the same situation in Android and we now send our notifications to GCM, it would send the canonical ID in the first response, so we can react to that to not send a second notification. But with iOS it does not. The response looks like a normal, complete, successful request.

Did we miss something or didn't GCM implement canonical ids for iOS? I couldn't find any information regarding this problem.

Upvotes: 0

Views: 406

Answers (1)

ztan
ztan

Reputation: 6921

A registration token is per device per installation. Every time you uninstall and reinstall your app (either iOS or android), GCM will give you a new registration token.

It is a similar concept to Canonical IDs. If you get a Canonical ID, then you need to replace your old registration token in your server with the newly returned Canonical ID, as eventually the old registration token will stop working.

So, if you get a new registration token back when you uninstall and reinstall your iOS app (or Android app), you can simply compare the newly returned token with the old one. If the new token is different from the old token, then you can just replace the old one with the new one in your server so that you dont need to maintain 2 tokens in your server.

Upvotes: 1

Related Questions