Array

Notifying the Mobile Client of New Surveys

Must Read

Admin
Admin
Just post!

Tailspin wants a way to notify users of new surveys from the user’s list of preferred tenants. Tenants are subscribers to the cloud-based Tailspin Surveys application who publish surveys. Users will then be able to synchronize the mobile client application and start using the new surveys.

Overview of the Solution

Tailspin chose to use the Microsoft Push Notifications Service (MPNS) for Windows Phone to deliver information about relevant new surveys to users with Windows Phone 7 devices. This feature allows the cloud-based Surveys application to notify a user about a relevant new survey even when the mobile client application isn’t running. This is possible even though you can’t write a background task to run on the Windows Phone 7 device when your application isn’t running.

Figure 3 shows, at a high level, how this notification process works for the Tailspin Surveys application.

Push notifications for Windows Phone

Figure 3 shows how an application on the Windows Phone 7 device can register for push notifications from another application—a service running in Windows Azure in this case. After the registration process is complete, the service in Windows Azure can push notifications to the Windows Phone 7 device. The following describes the process illustrated in Figure 3:

  1. The registration process starts when the client application establishes a channel by sending a message to the MPNS.
  2. The MPNS returns a URI that is unique to the instance of the client application on a particular Windows Phone 7 device.
  3. The mobile client application can also specify which types of notification it will receive; this part of the registration
    process sets up a binding that enables the phone to associate a notification with the application and enables the user to launch the mobile application in response to receiving a message. The Windows Phone 7 Application Certification Requirements specify that you must provide the user with the ability to disable toast and tile notifications. You must run the application at least once to execute the code that establishes the channel before your phone can receive notifications.
  4. Establishing the channel simply enables the phone to receive messages. The client application must also register with the service that will send the notification messages by sending its unique Uniform Resource Identifier (URI) to the service. In the Surveys application, there is a Registration web service hosted in Windows Azure that the mobile client application can use to register its URI for notifications of new surveys.

The service can use the unique URI to send messages to the client application. The Surveys service sends a message to a mobile client by sending a message to the endpoint specified by the URI that the client sent when it registered. The MPNS hosts this endpoint and forwards messages from the service on to the correct device.

For more information about the certification requirements that relate to push notifications, see Section 6.2, “Push Notification Application,” of Windows Phone 7 Application Certification Requirements. You can download a PDF copy of this document from the Microsoft Download Center (http://go.microsoft.com/?linkid=9730558).

Note: The sample application uses the free, unauthenticated MPNS that limits you to sending 500 notification requests per channel per day. If you use the free version of MPNS, it also means that your application is vulnerable to spoofing and denial of service attacks if someone impersonates the worker role that is sending notifications.

The authenticated MPNS has no restrictions on the number of notification messages you can send, and it requires the communication between your server component and MPNS to use Secure Sockets Layer (SSL) for sending notification messages.

For more information about the Microsoft Push Notification Service, see “Push Notifications Overview for Windows Phone” on MSDN (http://msdn.microsoft.com/en-us/library/ff402558(VS.92).aspx).

Inside the Implementation

Now is a good time to walk through the code that implements push notifications in more detail. As you go through this section, you may want to download the Visual Studio solution for the Windows Phone 7 Tailspin Surveys application from CodePlex (http://go.microsoft.com/fwlink/?LinkId=205602).

 

- Advertisement -

Latest News

Elevate Your Bentley Experience: The Bespoke Elegance of Bentayga EWB by Mulliner

Bentley Motors redefines the essence of bespoke luxury with the introduction of the Bentayga EWB's groundbreaking two-tone customization option—a...
- Advertisement -

More Articles Like This

- Advertisement -