Android GCM registration ID change

安稳与你 提交于 2019-12-25 06:58:56

问题


I know this is a silly question but important for me. I am developing an application which uses GCM. I searched and read regarding the GCM and having some question related to this as:

  1. Is the registration_id of GCM change after App update? If yes then how to handle it?
  2. Is the registration_id of GCM change after Android update? If yes then how to handle it?
  3. Is the registration id changes with every time registration to GCM from the same device and same app?
  4. Do the app need to call registration to GCM method every time when app runs?
  5. Can the app wait till the token or registration process complete in background?

I refereed the This Link to implement GCM in my app.


回答1:


check GCM

The periodical refresh never happened. The registration refresh is not included in the new GCM library.

However you can also unregister device and set expiry on it.

Do the app need to call registration to GCM method every time when app run?

No until you unregister you dont need to call it.




回答2:


I'll try to answer some of your questions.

  1. Is the registration_id of GCM change after App update? If yes then how to handle it?

Ans. : Yes, registration_id of GCM change after App update here you can find explanation.

  1. Is the registration_id of GCM change after Android update update? If yes then how to handle it?

Ans. : Yes, registration_id of GCM change after App update here you can find explanation.

  1. Is the registration id changes with every time registration to GCM from the same device and same app?

Ans. : No, It'll be same as long as the app is not updated or android version of device is not changed.

  1. Do the app need to call registration to GCM method every time when app run?

Ans. : If you have an app where user has to do login then at login success step you can but registration. And it doesn't take much time to register the device. If the id is changed, it'll give new id or else will return old one so no worries about duplication or such problems.

  1. Can the app wait till the token or registration process complete in background?

Ans. : You can do this in background thread as well. But it doesn't take much time so you can do it normally as well.

I hope, am able to answer you questions. Let me know if I am wrong anywhere. Accept my answer if you agree with me.

Thanks.



来源:https://stackoverflow.com/questions/37043298/android-gcm-registration-id-change

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