Would device registration id of C2DM expires?
Well, I know that the registration id of server would expire. However, how about the device registration id? If yes, how do the server and clie开发者_高级运维nt know about that?
Now I just simply save the id into database and assume it would never change.
Btw, is the registration id of server associated with the device registration id? Why the tutorial from the internet store them in the pair
Short answer is Yes, as stated here.
The application should store this ID for later use. Note that Google may periodically refresh the registration ID, so you should design your application with the understanding that the REGISTRATION Intent may be called multiple times. Your application needs to be able to respond accordingly.
Basically what would have to happen is that your application needs some sort of communication with your server to notify it that it received a new id. What you could do is when the app receives a registration id, store it on some remote database along with some additional unique information about that device (or user credentials if app has authentication). When Google decides to change the registration id, just update the previous entry on the remote db with the new id. Then when your server needs to push a message to some device, it matches the device to an up-to-date registration id in the database and uses that id to push the notification.
精彩评论