Android C2DM - What happens if registration ID gets refreshed

ε祈祈猫儿з 提交于 2019-12-10 23:35:49

问题


in my Application I'am currently sending a registration intent to the google server everytime the app starts. I get a different registration ID everytime I do that, though the old ones still work. I guess thats not a good way to do it. So I thought that I should send the registration intent only once - at the first start of the app. Now my question, if google refreshes the registration ID, do they inform the application about that? Whithout my app sending anything to them?


回答1:


I have an C2DM and my solution was to register on every start of the application, but when using when sending the C2DM messages through my server delete the entry of the database if the error code was a InvalidRegistration

So if a device was registered multiple times, I only send one invalid message.




回答2:


You could ping the business server if the registration have changed. You could ask for a registration update once a day.

Meaning that you can save the registration in the phone using the preferences and then only stream to the server if it has changed.

Although I am pretty sure the registration changes every time you ask for a new one. Maybe there's a way to check if a registration is still valid?



来源:https://stackoverflow.com/questions/8178855/android-c2dm-what-happens-if-registration-id-gets-refreshed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!