nurulnabi
nurulnabi

Reputation: 459

registring on gcm multiple time from same device will generate multiple id or same and multiple users on same device

I want to know If I am registering my android app multiple time on gcm from same device will I get different registration id each time or the same one once registered?

Coming onto my second problem which is as below

Upvotes: 1

Views: 383

Answers (1)

Mr.Rebot
Mr.Rebot

Reputation: 6791

AFAIK, this will be handled by GCM but as stated in this forum the solution would be to filter them on the client side. Your GCM notification should pass on which user it is for. Then in your onReceive method you should check who is currently logged in.

For your last question, according to the documentation - Registering:Client Apps

If a bug in the client app triggers multiple registrations for the same device, it can be hard to reconcile state and the client app might end up with duplicate messages.

Implementing canonical IDs can help you more easily recover from these situations. A canonical registration ID is the registration token of the last registration requested by the client app . This is the ID that the server should use when sending messages to the device.

If you try to send a message using an old registration token, GCM will process the request as usual, but it will include the canonical ID in the registration_id field of the response. Make sure to replace the registration token stored in your server with this canonical ID, as eventually the old registration token will stop working.

Upvotes: 1

Related Questions