Is it possible to get two or more different GCM tokens within the same Android app and be able to simultaneously receive messages sent to either one?
1 Answers
It may happen but eventually, you can't use it in a way that you can simultaneously receive messages sent to either one. Token is created when your app comes online. This will fall in Canonical IDs:
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.
Here are some links that may help you: