Windows Phone 8 push notification push channel always creates new channel uri

这一生的挚爱 提交于 2019-11-30 04:34:20

You're mostly doing it right.

Push Notifications are a funny thing.
You create a channel, send it to your server and then the server can send until it fails (the channel Uri expires or there's an error). At which point the app needs to create a new ChannelUri and then UPDATE the value stored for that app/device on the server. The server will then be able to send notifications.

Some important points

  1. When a new channel Uri is requested for one that is still valid you'll get the same one back.
  2. When your ask for a new channel uri and the current one has expired, you'll normally get the same uri returned but the channel will be made live again.
  3. There is no way to know if a channel has expired from within an app without running code like your registerPushChannel method. (Unless you track this on your backend and the app queries the backend.)
  4. There is no way to tell the app that a channel has expired, or tell the user to reopen the app to re-establish a channel connection using the push infrastructure.

The standard way to try and ensure that the channel is always available is to check the channel whenever the app is started.
This is what you're doing, you probably just want to make sure you're updating server records not just adding more.

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