Windows Phone 7 push notification)

Source: Internet
Author: User

Benefits of using push notifications

1. Saving your battery power.

2. You can push notifications to inform your usersProgramSome interesting things happen, even if the program is not running.

 

Push notification process

When a user runs a program for the first time on a mobile phone, the application calls Microsoft's push notification service and requests a custom URI for communication.

When an event is triggered in your web service, you should pass the information to that Uri (with a specific load), and then push the notification service to update it with active tiles, toast notifications or real data in programs send data to users' mobile phones.

Obtain the custom URI from the push notification service.

We need to use the Microsoft. Phone. Notification assembly to obtain a custom URI from the push notification service (PNS. First, I have to create an httpicationicationchannel. It will automatically communicate with PNS (in another thread) and capture the content returned by the service through an event.

Httpicationicationchannel is a class used to create a notification channel between the push notification service and the push client. It is used to create a raw, tile, and toast notification subscription. The channel creation process is as follows: if the channel already exists, the client application should try to open it again. An exception occurs when you try to recreate an existing channel. If the channel is not enabled, subscribe to Channel Events and try to open the channel. Once the channel is opened, the channeluriupdated event is triggered. This event may send a signal to the client that successfully created the channel. The existing channel can be found by name. If the channel is successfully found, the channel will be reactivated and can be used in the application. The entire process is asynchronous.

Once you have a URI, you can save it in web service. The Web Service initializes the information that will be sent to your mobile phone. We have three methods to implement this: Tile notifications, toast notifications, and Native notifications.

Native notification )-Native notifications are used for programs that are actually running in the device. It allows you to update the user interface in real time during use.

Toast notification )-This message is received no matter whether the program is running or not, but it may be a bit annoying to bring up the toast message when the program is running.

Cloud Service can generate a special push notification called toast notification, which is usually displayed on top of the user's current screen. for example, the weather application may want to display bad weather reminders as toast notifications. if the user decides to click toast notification, the application will start and execute other actions. Cloud Service can control the title and subtitle of toast notifications. The toast notification also displays the application icons included in the deployment package.

Tile notification )-If your program is pinned to the start interface, you can use the tile notification to update the tile. You can change the background image and an integer between 0 and 99.

Tile is a visible and dynamic display of applications or their content in the mobile phone quick start zone. for example, the weather application may choose to use tile to display the user's local time and climate. because cloud services may change the appearance of tile at any time, this mechanism can be used to continuously convey information to users. each mobile app is associated with a separate tile, but you can control which tile is appended to the quick launch zone.

Cloud Service can control the background image, counter (or badge), and title attributes of tile. These attributes are configured using Windows Phone Developer Tools. The animation and sound attributes of tile are set by the platform rather than controlled by applications. For example, if the platform is set to respond to any tile update with animation and doodle sound, this is effective for any tile.

Refer to a local resource as part of application deployment or cloud resources. By referencing Resources in the cloud, applications can dynamically update the background image of tile. This allows scenes that require background image processing before being displayed to be applied. In most cases, the application package should contain all the required tile background images, so this is the best solution to improve performance and battery life.

 

Toast and tile notifications are defined by the system on Windows Phone 7. Unlike raw notifications, all applications can create their own load formats and parse them accordingly.

 

Notification Type

Http://msdn.microsoft.com/en-us/library/ff941124 (V = vs.92). aspx

 

Push notifications to Windows Phone

The http://msdn.microsoft.com/en-us/library/ff402545 (vs.92). aspx

 

Tutorial: Dynamic Block push notification for Windows Phone 7)

Http://msdn.microsoft.com/zh-cn/gg615432.aspx

 

Microsoft official tutorial documents and examples of push notificationsSource code(Source code of the experiment document)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.