Sending a Raw Notification

Sending a raw notification differs from sending tile and toast notifications in that there is greater flexibility over the contents of the body of the notification.

Listing 15.3 demonstrates sending an object as part of a raw notification, using a DataContractJsonSerializer. As with tile and toast notifications, we create an HttpWebRequest, convert the content to a byte array, and then write it to the request Stream. Finally, we verify that the notification was correctly received by the MPNS.

LISTING 15.3. PushNotifier Class (excerpt)—Sending a Raw Notification

public PushNotificationSendResult SendRawNotification(    object content, string url, PushNotificationPriority priority){     ...

Get Windows® Phone 8 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.