,

Notification Classes

Some kinds of notifications may be more time critical than others. For example, a notification indicating that tomorrow’s weather forecast has changed may be less time critical than a notification about a traffic jam on your planned route home. The MPNS allows notifications to be assigned a batching interval, which works as a guide for the MPNS in determining when to deliver one or more notifications in a batch.

To inform the MPNS of the batching interval of a notification, a header named X-NotificationClass is added to the outgoing request. The batching interval is a string representation of an integer value. The set of valid priority values is determined by the kind of notification, be it a toast, tile, or raw notification.

When notifications are sent to the MPNS, they are placed in queues (see Figure 15.8). Each queue is serviced at different intervals according to its notification class. Accordingly, a queue for a lower notification class may be serviced more frequently than one with a higher notification class. For example, a raw notification with an X-NotificationClass of 3 means that the message is delivered by the MPNS immediately, a value of 13 means that the message is delivered within 450 seconds, and a value of 23 means the message is delivered within 900 seconds.

Image

FIGURE 15.8 Notifications are queued and the notifications from each queue are periodically sent to the phone.

When sending a push notification, the X-NotificationClass may be omitted, in which case a default regular priority is used. Table 15.1 lists the push notification classes for each notification type.

TABLE 15.1. Push Notification Classes

Image

In the downloadable sample code, the notification class is represented as an enum called PushNotificationPriority and provides for strongly typed notification class values.

public enum PushNotificationPriority
{
    Regular,
    Priority,
    RealTime
}

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.103.227