Google Cloud Messaging registration id expiration

后端 未结 4 730
野性不改
野性不改 2020-12-30 10:53

I am using Google Cloud Messaging for my Android application and I am trying to understand when the registration id expires. From this post I was able to understand that Goo

4条回答
  •  佛祖请我去吃肉
    2020-12-30 11:18

    As per http://developer.android.com/google/gcm/client.html#sample-register, unlike previous versions of GCM and C2DM, Google itself does not refresh the registration. Once you have the registration id from the initial registration you are good to go, except for one case: you do still need to re-register when the user upgrades to a new version (this case is also handled in the example in the link above).

    When an application is updated, it should invalidate its existing registration ID, as it is not guaranteed to work with the new version. Because there is no lifecycle method called when the application is updated, the best way to achieve this validation is by storing the current application version when a registration ID is stored.

提交回复
热议问题