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

后端 未结 1 1341
借酒劲吻你
借酒劲吻你 2020-12-29 00:36

I wanted to check that my push notification implementation is correct.

Each time I open my app (in actual fact I register the push channel only on a specific page s

相关标签:
1条回答
  • 2020-12-29 01:21

    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.

    0 讨论(0)
提交回复
热议问题