What does a Windows Phone 7.5 tile push notification message look like?
Posted: (EET/GMT+2)
I'm currently working on several Windows Phone 7 applications, and one of the features required is a push notification (PN) for the live tile of the application. While studying the XML required from the Internet, I actually had a hard time finding information that would be current and would work in production. For instance, there were numerous blog posts about the required XML format, but in many cases, it was from the 7.0's beta era, and thus didn't work with current 7.5 (7.1) production phones any more.
Of course, MSDN has the official documentation, but then again, there's lots of text to read when all you need is that simple piece of XML.
So, here's how the simplest possible XML snippet to be sent to Microsoft's Push Notification Service (MPNS):
<?xml version="1.0" encoding="utf-8"?>
<wp:Notification xmlns:wp="WPNotification">
<wp:Tile>
<wp:BackgroundImage> url </wp:BackgroundImage>
<wp:Count> count </wp:Count>
<wp:Title> text </wp:Title>
</wp:Tile>
</wp:Notification>
Above, the URL field can either point to a web resource ("http://www.domain.com/something.jpg") or to a local image file part of the project. In case you are using a local image file, it's Build Action in file properties must be set to Content.
Also, recall that you must pre-register possible external image URLs with the BindToShellTile method before you can use them. The tile image size is 173 × 173 pixels, and external images must be smaller than 80 KB. For local images, you start the URL with the forward slash: "/MyImage.png" if the image is at the root of the source code project.
For a complete C# and XML code example, see this document on MSDN.
Happy hacking!