Android GCM Server error: Device Subscription Expired

天大地大妈咪最大 提交于 2020-01-04 06:14:19

问题


On sending notifications to an Android device via GCM I am getting the following response:

Device Subscription Expired: PushSharp.Android.GcmPushService -> AppId

Due to this issue I experience random issues on the phone. For example, the app receives extra call backs on the receiver.

Can someone please provide more details about this error? When does it occur? Is it similar to device id registration? What needs to be done to handle this situation?

Thanks!


回答1:


If you look at the code of GcmPushChannel.cs, you'll see that DeviceSubscriptonExpiredException is returned when either Google return NotRegistered error or a CanonicalRegistrationId.

Since you are saying your app gets extra calls on the receiver, it's possible that you have in your DB multiple registration IDs for the same device, and when you send a message to all of them, your device gets multiple messages. This would explain why you get a canonical registration ID in your response from Google.

I'm not sure how Push Sharp handles Canonical Registration ID. From the little code I read it's possible that it fires an event that allows you to delete the old registration ID from your DB.



来源:https://stackoverflow.com/questions/18992017/android-gcm-server-error-device-subscription-expired

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