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.
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.
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
}
3.147.103.227