Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GCM Token validation

I am little bit confused in validating the GCM token. I am working in cross platform application using Sencha framework and my server side is in Java. I have a query regarding how to validate the registration ID (GCM token)? Is there any specific API to validate the GCM token? Can you guide me how to handle this, either in client side or server side? I have already did registration part in server side, where user can register their GCM token in database. Now I need to validate this registration token.

Is unregistering the application every 2 weeks a good approach ?

like image 483
RED.Skull Avatar asked Feb 15 '23 04:02

RED.Skull


1 Answers

You register to GCM and un-register from GCM in the client side. That's where you get the registration ID from Google.

Once you have a registration ID, you should consider it valid until :

  1. You send a message with the registration ID to Google's GCM Server and get a NotRegistered or InvalidRegistration error. In these cases you should remove the registration ID from your DB.

  2. You send a message with the registration ID to Google's GCM Server and get a successful response, but the response contains a canonical registration ID. In this case you should replace the registration ID with the canonical registration ID.

  3. The app explicitly un-registered from GCM, and notified the server about it, in which case you should remove the registration ID from your DB.

I don't see any point in un-registering the app every two weeks. Google's code samples only re-register the app once a new version of it is installed, and even then they don't un-register before re-registering.

like image 200
Eran Avatar answered Feb 17 '23 19:02

Eran