MOBILE

Windows Phone 7 Development : Push Notifications - Understanding Push Notifications

5/5/2011 3:55:44 PM
The Windows Phone 7 platform provides developers with three types of push notifications: toast notifications, tile notifications, and raw notifications. All three types follow the same basic principles of operation and processing, yet differ in the way they display notifications. Toast and tile notification types are used only when the application is not running; raw notifications are used to continuously receive messages while the application is running in the foreground. Let's discuss each notification type in detail.

1. Toast Notifications

Toast notifications are displayed as overlays at the top of a phone's screen. Only a message title and a line of text can be controlled by the service or an application sending ("pushing") a toast notification; the icon that appears on the left side of a toast notification is the default icon for the application deployed on the Windows Phone 7 device. You can display toast notifications only when an application is not running; if an application is running when a toast notification is sent, it is not displayed on the phone screen.

Toast notifications are used to display information that is timely and urgent. An example of toast notification is shown in Figure 1, where it appears as "Time to buy..." text at the top of the phone screen. Here, a notification has been received about Microsoft stock becoming an attractive buy. If the user chooses to tap (or click) the toast notification, an application opens up, allowing users to take additional actions within the application.

Figure 1. Sample toast notification

2. Tile Notifications

Tile notifications can alter the contents of any application tile that is pinned to the Quick Launch area of the phone initial screen (also referred to as Start Experience/Start Screen in Microsoft documentation). Tile notifications are used to communicate information visually, by displaying, say, dark clouds with rain to represent a rapidly approaching storm. Generally, an application tile is a visual representation of an application and its contents or functionality. An application tile typically contains an icon and two strings, and tile notifications can change any of these elements, as well as the background of each tile. To change a tile's background image, a tile notification must include a URI that points to the new image, a URI that can be either local or cloud-based. The string at the bottom of an application tile is referred to as the tile title. The string in the middle and slightly to the right is referred to as the tile counter.

3. Raw Notifications

The third and final type of push notification is the raw notification, which can be used to continuously send messages or updates to a Windows Phone 7 application that is running in the foreground. Contrast this with toast and tile notifications, which are used to send updates to an application when it is not running front and center on the Windows Phone 7 device. Unlike toast and tile notifications, all raw notifications are dropped once an application is no longer running in the foreground on the Windows Phone 7 device. Raw notifications are an energy-friendly alternative to constantly polling web services for data; this type of push notification also eliminates the need to keep connections to web services open for prolonged periods of time.

Each notification type has its "niche," so to speak, or the specific application development scenarios it shines with more than the others. For instance, if an application receives updates only when it's actively used, such as a chat application, then a raw notification is the most appropriate mechanism for transmitting these updates. If an application is ideally suited to communicate updates via the use of visual elements on an ongoing basis, such as weather updates, sports events scores, or stock prices, tile applications are a more appropriate choice. Finally, if text-based messages are the most appropriate form of communication on an around-the-clock basis, such as e-mail receipts, Facebook friend requests, or news alerts, toast notifications would be most suitable.

Having taken a look at three available push notification types, let's turn our attention to the architecture of notification services, since knowing the architecture will help you better understand how to program and troubleshoot push notification services.

Table 1. Characteristics of Windows Phone Push Notification Types
PN TypeMust Application Be Running in Foreground?Must Application Tile be Pinned to Start Screen?Use
ToastNoNoUrgent and time-sensitive data (e.g., storm warning)
TileNoYesUpdates (e.g., count of new messages)
RawYesNoContinuous data (e.g., Twitter client, stock ticker)
Other  
  •  Windows Phone 7 Development : Handling Multiple Concurrent Requests with Rx.NET
  •  WAP and Mobile HTML Security : Application Attacks on Mobile HTML Sites
  •  WAP and Mobile HTML Security : Authentication on WAP/Mobile HTML Sites & Encryption
  •  iPhone Application Development : Displaying and Navigating Data Using Table Views - Building a Simple Table View Application
  •  iPhone Application Development : Understanding Table Views and Navigation Controllers
  •  Windows Phone 7 Development : Revising WeatherRx to Manage Slow Data Connections
  •  Windows Phone 7 Development : Handling Data Connection Issues with Rx.NET
  •  Windows Phone 7 Development : Handling Errors in Rx.NET
  •  Windows Phone 7 Development : Using Rx.NET with Web Services to Asynchronously Retrieve Weather Data
  •  Windows Phone 7 Development : Media - Adding Sounds to an Application
  •  iPhone Application Development : Building a Multi-View Tab Bar Application (part 4) - Implementing the Summary View
  •  iPhone Application Development : Building a Multi-View Tab Bar Application (part 3) - Implementing the Volume View
  •  iPhone Application Development : Building a Multi-View Tab Bar Application (part 2) - Implementing the Area View
  •  iPhone Application Development : Building a Multi-View Tab Bar Application (part 1)
  •  Windows Phone 7 Development : Working with Video (part 2) - Coding the Application
  •  Windows Phone 7 Development : Working with Video (part 1)
  •  Windows Phone 7 Development : Plotting an Address on a Bing Maps Map and Working with the Bing Maps Service
  •  Windows Phone 7 Development : Using GeoCoordinateWatcher and the Bing Maps Control to Track Your Movements
  •  iPhone Application Development : Creating a Multi-View Toolbar Application (part 3) - Adding Toolbar Controls
  •  iPhone Application Development : Creating a Multi-View Toolbar Application (part 2) - Instantiating the View Controllers
  •  
    Top 10
    Ultrabook Supertest (Part 2) - Acer Aspire Timeline U M5
    Ultrabook Supertest (Part 1) - Acer Aspire Timeline U M3
    Ultrabook Supertest (Part 8)
    Ultrabook Supertest (Part 7) - Lenovo U310
    Ultrabook Supertest (Part 6) - HP Envy 6
    Ultrabook Supertest (Part 5) - HP Envy 4
    Ultrabook Supertest (Part 4) - Dell Inspiron 14z
    Ultrabook Supertest (Part 3) - Asus Zenbook Prime UX31A
    How To Make The Most Of Dropbox (Part 2)
    How To Make The Most Of Dropbox (Part 1)
    Most View
    Microsoft XNA Game Studio 3.0 : Displaying Images - Using Resources in a Game (part 4) - Filling the Screen
    Themes on Windows Phone 7 Devices (part 2) - Changing the Theme & Detecting the Currently Selected Theme
    Programming Microsoft SQL Server 2005 : The XML Data Type (part 2) - XML Schemas
    iPhone Application Development : Using Switches, Segmented Controls, and Web Views (part 3)
    2012 - The Year to Come (Part 3)
    ASUS Rampage IV GENE - For the Compact Enthusiasts
    Compact Digital Cameras Under $300 (Part 3) - Canon IXUS 125HS
    Sennheiser New Wireless Headphones : PXC 360 BT, MM550 –
    Buying Guide: CPU Cooling Equipment (Part 7) - Gelid Solutions GX-7,Rosewill RCX-SC1U-1366,Scythe NINJA 3 Rev.B
    Windows Tips & Tricks (June 2012) – Part 2 - Maximizing windows only to a certain extent , Lock your computer with an easy shortcut
    Compact Cameras For The Dynamic
    Thunderbolt - Chain Reaction
    The Android Army invades! (Part 3) : Disaster recovery
    Programming with DirectX : Shading and Surfaces - Additional Texturing Topics
    AMD Radeon HD 7970 - The World's Fastest Single-GPU (Part 1)
    Lumia 800 And 710 Are Updated To 7.5
    System Center Configuration Manager 2007 : Developing the Solution Architecture (part 5) - Site Design,Client Architecture,Multilanguage Scenarios
    SQL Server 2005 Data Protection
    Combine The Pieces Together - Third Party Windows Defragmenter (Part 2) - Ashampoo Magical Defrag 3, IObit Smart Defrag 2.3
    Windows 7 : Indexing Your Computer for Faster Searches (part 1) - Adding or Removing Indexed Locations