Sadegh Saati
Sadegh Saati

Reputation: 11

Different GCM Registration ID on a device

I need to get different Registration ID on a device for every user that logins in my application and handle different notification for different users,How?

Upvotes: 0

Views: 888

Answers (2)

Eran
Eran

Reputation: 394086

Actually if you unregister GCM and register for a new user, even if you get a new registration id, the old one will still work. When you push to the old one, you'll get in the response a canonical registration id, whose value is the new registration id. That's Google's way of telling your server to use only the latest registration id, but old registration ids keep on working for a long time.

Therefore, when the user logs out, you must call your server and delete the old registration id from your db.

Upvotes: 3

Sunil Mishra
Sunil Mishra

Reputation: 3826

You should call unregister() method on your logout button. This will invalidate the registration ID.

Look at the documentation for more details.

Upvotes: 0

Related Questions