user1122549
user1122549

Reputation: 738

Android GCM Server error: Device Subscription Expired

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!

Upvotes: 2

Views: 4534

Answers (1)

Eran
Eran

Reputation: 393781

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.

Upvotes: 5

Related Questions