2

I am working on my first Windows UWP app. And planning use Windows push notifications to notify the app about some server updates. This app will not have internet access always. It might be offline for couple of days. So I wanted to make sure whether I can use Push notifications in such a situation. When the notification is sent from the server if that device is offline, how long it will be there without being removed from the queue?

In a article I have read "By default, push notifications expire three days from the time that they are received by Windows Push Notification Services (WNS). If needed, you can override this default with an explicit expiration time." But I am not sure whether this is referring to what I am asking or whether it's saying that when it's delivered to the device, the tile, badge etc will remove that after 3 days.

Can you please clarify this.

Madhu
  • 1,209
  • 2
  • 22
  • 28

1 Answers1

0

By default, push notifications expire three days from the time that they are received by Windows Push Notification Services (WNS). If needed, you can override this default with an explicit expiration time.

I'm not sure where you've read this. However, this is not quite right. The three days expiration time refers to the lifespan of tile and badge notifications when they have been delivered by the device. It does not start from the time that they are received by WNS.

By default, local tile and badge notifications don't expire, while push, periodic, and scheduled notifications expire after three days. So in Expiration of tile and badge notifications, it says

By default, tile and badge notifications expire three days after being downloaded.

And we can change the expiration time for each notification by setting the X-WNS-TTL header. This header is uaually used if you want to ensure that your notifications are not displayed later than a certain time. The TTL is specified in seconds and is relative to the time that WNS receives the request.

For your question, from the Important notes under Sending a notification in Windows Push Notification Services (WNS) overview, we can find that:

When the device is offline, by default WNS will store up to five tile notifications (if queuing is enabled; otherwise, one tile notification) and one badge notification for each channel URI, and no raw notifications. This default caching behavior can be changed through the X-WNS-Cache-Policy header. Note that toast notifications are never stored when the device is offline.

And in X-WNS-Cache-Policy header, we can get more information.

When the notification target device is offline, WNS will cache one badge and one tile notification per app. If notification cycling is enabled for the app, WNS will cache up to five tile notifications. By default, raw notifications are not cached, but if raw notification caching is enabled, one raw notification is cached. Items are not held in the cache indefinitely and will be dropped after a reasonable period of time. Otherwise, the cached content is delivered when the device next comes online.

So when your app is offline, WNS can cache some push notifications for you, but it's hard to say how long they will be cached.

WNS responds to indicate that the notification has been received and will be delivered at the next available opportunity. However, WNS does not provide end-to-end confirmation that your notification has been received by the device or application.

WNS does not guarantee the reliability or latency of a notification. If you want to make sure users can be notified about the server updates, you may need to use some other techniques. For example, you can send an active request to the server for the server updates when the app is online.

Jay Zuo
  • 15,653
  • 2
  • 25
  • 49