23.01.2018 Views

MICROSOFT_PRESS_EBOOK_PROGRAMMING_WINDOWS_8_APPS_WITH_HTML_CSS_AND_JAVASCRIPT_PDF

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Debugging Tips<br />

When using push notifications, experience shows that if notifications aren’t getting through, it’s typically<br />

not a problem with WNS. Here’s a list of things to check (thanks to Hans Andersen for this list):<br />

• Check the return status of your HTTP POSTs to WNS. If it’s returning an HTTP 200 response,<br />

check the X-WNS-NotificationStatus and other headers you get back. Look particularly for the<br />

status of “Received,” which indicates that a notification has gone to the client.<br />

• Lacking anything conclusive in the headers, run Event Viewer and check the events under<br />

Application And Services Logs > Microsoft > Windows > Push Notifications Platform ><br />

Operational to see the activity.<br />

• Also look under Application And Services Logs > Microsoft > Windows > Immersive-Shell ><br />

Microsoft-Windows-TWinUI > Operational to see if there are error messages related to XML<br />

parsing about the same time you expected to receive a notification.<br />

• Even if the XML is well-formed, an update might not show up if a referenced image is either too<br />

large (pixel dimensions or file size), if the image is the wrong format (for example, TIF), if the<br />

image is corrupt, if the server handling the image request can’t handle the query parameters for<br />

the tile (scaling, contrast, language), or if the server is encountering other errors as might be<br />

revealed in its own logs.<br />

• If updates appear but after a considerable delay, it could just mean internal timeouts or other<br />

network latency within the tile and notification infrastructure. If this happens, just accept that the<br />

world isn’t always perfect and operations must sometimes be retried!<br />

Windows Azure Toolkit and Windows Azure Mobile Services<br />

Clearly, plenty of work is involved to create a service capable of receiving channel URIs and sending<br />

notifications through WNS. Recognizing this, the Windows Azure Toolkit once again provides some<br />

solutions. Going into all the details is beyond the scope of this book, but the link above will get you<br />

started. More specifically, check out the Azure Notifications Samples and the Raw Notifications Sample,<br />

as well as the Push Notification Worker sample. There is also a helpful video on the Channel 9 site:<br />

Episode 73 – Nick Harris on Push Notifications for Windows 8. Additional resources have likely been<br />

published since this chapter was written, so a quick Internet search will likely turn up more.<br />

Also check out Windows Azure Mobile Services, which helps you create a scalable backend for an<br />

app, including structured cloud data, authentication, and push notifications. This is quite new as of the<br />

time of writing, so I don’t have links to other resources, but it’s certainly worth looking into.<br />

614

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!