How to handle GCM changing the registration Id?

ⅰ亾dé卋堺 提交于 2019-12-07 20:16:34

问题


I was wondering how will app/device be notified if GCM server decides to refresh the registrationId which the app previously retrieved from the GCM server. Currently, I save the 1st retrieved registrationId and save it in the database and send this registrationId to App server. So, from next time App won't be talking to GCM server. In this case App will never know if the registrationId is changed by GCM server. Google document suggest something to handle the case, but it does not mention what steps should be taken. Quote from Google -

Although the com.google.android.c2dm.intent.REGISTRATION intent is typically received after a request was made by the application, Google may periodically refresh the registration ID. So the application must be prepared to handle it at any time.

Any suggestion will be helpful,

Thanks, SKU


回答1:


The old reg id continues to work for a while but Google send out a new one to be used in future in the canonical_id field of the response.



来源:https://stackoverflow.com/questions/13689530/how-to-handle-gcm-changing-the-registration-id

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