I have just started using C2DM. I prefer to send REGISTRATION intent only once to the C2DM servers (When the app launches for the first time). And i save the registration_id that i receive from the C2DM server. The problem is, how will the application server know when C2DM refreshes my registration_id ? Will i receive any notification or intent from C2DM servers when the ID gets refreshed ? Whats the better and efficient way to handle this changeable registration id..?
There is a similar question here. But i did not find what i need there. Any help would be really appreciated 🙂 Thank you.
If the registration ID is refreshed by the server, you will be sent a new one, just as if you requested it, via the Intent
action com.google.android.c2dm.intent.REGISTRATIONSo as long as your app can receive a registration ID, then you have done what is needed to receive a new one, if the C2DM servers decide for some reason to issue a new registration ID.
Requesting a new registration ID every time the app starts is not a good approach (except to get one initially) as it increases the chances of getting into a situation where the client device has a different registration ID to the app server, so C2DM messages fail to arrive.