famer
famer

Reputation: 499

Windows phone push channel expiration

I have got trouble when i send push notification to phone it returns with this errors:

[X-SubscriptionStatus] => Expired
[X-NotificationStatus] => Dropped
[X-DeviceConnectionStatus] => Connected

From this point i have two questions:

  1. What to do now as far as I don't get normal instructions in docs and recreation of push channel return same url
  2. How do i realize that expiration happend on client side? As far as in real world runtime phone just will stop receiving messages and wont know that something happend... Thank you

Upvotes: 2

Views: 1452

Answers (1)

MrMDavidson
MrMDavidson

Reputation: 2735

From the server side there is nothing you can do - you just have to stop sending notifications to that URI.

What you can do is try and make sure your ChannelUri doesn't expire, or if it changes, notify your server side application of the change. Basic process is;

1. Uniquely identify the phone. A very likely candidate is Microsoft.Phone.Info.UserExtendedProperties.GetValue("ANID") but be aware it'll require your app to have the ID_CAP_IDENTITY_DEVICE capability

2. Setup a HttpNotificationChannel on the phone and receive a ChannelUri.

3. Send the unique device identifier and the ChannelUri to your server.

4. Subscribe to ChannelUriUpdated notifications on the HttpNotificationChannel. Anytime this event fires send re-send the device id / ChannelUri pair to your server.

Following this pattern you should always have the correct push notification Uri on your server side, as long as the user periodically runs your application to refresh the push notification channel.

Upvotes: 3

Related Questions