You can try the following things:
- When the user logs out, send a request to delete the token on your server and delete it in your application;
- Once the user logs out, you can simply remove the association of “User ID” with “Current GCM” (or login ID) on your server. And when someone logs in again, you will create a new association with this token.
GCM current is application specific, but the association you create on your server is completely up to you.
And I cannot stress this enough, the token created by GCM, APP SPECIFIC . If your user is registering on multiple devices, your server should handle this by associating the user ID with multiple Registration ID tokens.
An identifier issued by GCM servers in an Android application that allows you to receive messages. When an Android application has a registration ID, it sends it to a third-party application server, which uses it to identify each registered message device for this Android application. In other words, the Registration ID is tied to a specific Android application running on a specific device.
And from the documents, your server should also:
Before you can write client applications using GCM, you must have an application server that meets the following criteria:
- Ability to communicate with your client.
- Ability to send correctly formatted requests to the GCM connection server.
- Ability to process requests and resend them using exponential backup.
- Ability to store API key keys and client tokens.
- Ability to generate message identifiers to uniquely identify each sent message. Message identifiers must be unique to the sender identifier.
EDIT: More on GCM here .
For further reading, you can also read “Device Group Messages” .
You can also download sample code here .
source share