2

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!

Eran
  • 387,369
  • 54
  • 702
  • 768
user1122549
  • 664
  • 1
  • 13
  • 27

1 Answers1

5

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.

Eran
  • 387,369
  • 54
  • 702
  • 768
  • Thanks for your response! I read the code and i was able to understand why i was getting the Device subscription failed. Basically it was happening when i un-installed the app after registering for push events thru it. In this scenario i had to stop sending notification to the particular reg id from my service. That solved the issue! – user1122549 Oct 04 '13 at 04:50