Reputation: 369
I have a question concerning Google Cloud Messaging.
When I install the same app, on two different google android devices with same google account - then both will register themselves in gcm. i am storing their regId on server.
but what happens when I send to one of the regid a message - will the second get the message too? -will one of the regid be canonical? (because of same google account on device like the other - or are they treated completely different?)
Upvotes: 3
Views: 1337
Reputation: 1388
What happens when I send to one of the regid a message - will the second get the message too?
Well, no. This is because GCM not only takes into account just the Google account that you use on your phone but also identifies the particular device and the particular app you are running on it. GCM id is unique for a any given app on any given device. That is how the cloud identifies which device to push notifications to. So even if you sign in to two different devices with the same account, both will register with different keys. You use this key to identify the individual device/app.
Go to the official documentation on this to get the full info.
Upvotes: 3
Reputation: 237
Sounds like you want to use User Notifications. The docs are pretty straightforward. Basically you'll need to do some work on the server side to map multiple registration ids to one "notification_key" then you use this key when pushing to Google.
Google handles pushing to the multiple devices and will even do some nice syncing type things for you.
Upvotes: 0