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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.