GCM token validation
I’m a bit confused when validating the GCM token. I work in a cross-platform application using the Sencha framework, and my server side uses Java. I have questions about how to verify my GCM token? Is there any specific API to validate the GCM token? Can you guide me on how to handle this on the client or server side? I’ve done the registration section on the server side, where users can register their GCM tokens in the database. Now I need to verify this registered token.
Is it a good way to unregister an app every 2 weeks?
You register with and unregister from GCM on the client. This is where you get your registration ID from Google.
Once you have obtained a registration ID, you should consider it valid until:
You send a message with the registration ID to Google’s GCM server and receive a NotRegistered or InvalidRegistration error. In these cases, you should remove the registration ID from the database.
You send a message with a registration ID to Google’s GCM server and get a successful response, but the response contains the canonical registration ID. In this case, you should replace the registration ID with the registration ID of the specification.
The app explicitly unregisters from GCM and notifies the server about this, in which case you should remove the registration ID from your database.
I don’t think it makes any sense to log out the app every two weeks. Google’s code samples will only re-register the app after installing the new version, and even then, they won’t unregister before re-registering.