Weather Service Push notifications

Version: 1.0.0

Description

The Microsoft Push Notification Service in Windows Phone offers third-party developers a resilient, dedicated, and persistent channel to send information and updates to a mobile application from a web service. This hands-on-lab will show you how to build an end-to-end push notification service, including subscribing to push on your phone and building the server-side code to send push notifications to the phone.

Overview

The Microsoft Push Notification Service in Windows® Phone offers third party developers a resilient, dedicated, and persistent channel to send information and updates to a Windows® Phone application from their web sites (web services).

In the past, a mobile application would need to frequently poll its corresponding web service to know if there are any pending notifications. While effective, polling results in the device radio being frequently turned on, impacting battery life in a negative way. By using push notifications instead of polling, a web service can notify an application of important updates on an as-needed basis.

Figure 1

Push Notifications

When a web service has information to send to an application, it sends a push notification to the Push Notification Service, which in turn routes the push notification to the application. Depending on the format of the push notification and the payload attached to it, the information is delivered as raw data to the application, the application's tile is visually updated, or a toast notification is displayed. The application can then contact the web service using its own protocol, if needed.

The Push Notification Service sends a response code to your web service after a push notification is sent. However, the Push Notification Service does not provide an end-to-end confirmation that your push notification was delivered from your web service to your application. For more information, see Push Notification Service Response Codes for Windows® Phone.

This lab covers push notifications and also introduces the usage of http services in Silverlight. During this lab you will create server side logic needed to send messages through the Push Notification Service. You will create a simple Windows® Phone 7 Codenamed Mango application which serves as a client to receive said notifications. The client application will receive weather updates. The server side business application (a simple WPF application) will send weather alerts to registered client applications through Push Notification Services. Once a client Windows® Phone 7 application receives such alert it will display the information received.

Note:
Note: The server side Weather application uses the WindowsPhone.Recipes.Push.Messasges.dll which encapsulates all the logic and functionality for sending and receiving responses from Microsoft Push Notification Services. For more information, see https://windowsteamblog.com/windows_phone/b/wpdev/archive/2011/01/14/windows-push-notification-server-side-helper-library.aspx.

Objectives

During the course of this lab you will:

  • Familiarize yourself with the communication capabilities of Windows® Phone 7 applications
  • Familiarize yourself with the push notification concepts and the behaviors they enable on the phone
  • Understand how push notifications work on the phone and in the cloud
  • Use the phone push notification services to create a subscription for Tokens (tiles), Toasts, and raw push notifications
  • Use a web client to register for Push Notifications
  • Use the network status to display the current status of the phone network
  • Create a SL application that registers with the push notification services (both token and toast)
    • Handle push events (token, toast, and raw) during run time
    • Show token and toast information on the shell
  • Manage application sub-tiles which update independently and link to specific locations in the application (only available on Windows® Phone 7.1)

Prerequisites

The following is required to complete this hands-on lab:

  • Microsoft Visual Studio 2010 Express for Windows® Phone or Microsoft Visual Studio 2010
  • Windows® Phone Developer Tools
    Note:
     All of these Tools can be downloaded together from https://go.microsoft.com/?linkid=9772716

Exercises

This hands-on lab comprises of the following exercises:

  1. Introduction to the Windows® Phone RAW notifications for Updates
  2. Introduction to the Toast and Tile Notifications for Alerts
  3. Introduction to sub-tiles and deep toast messages (only available on Windows® Phone 7.1)

Estimated time to complete this lab: 110 minutes.