1. WP message push Method
If we understand the C/S architecture, we can know that the message transmission from the client to the server can be bidirectional. The client can actively obtain messages from the server or passively receive notifications from the server, unlike the pure B/S architecture, browsers can only actively retrieve messages from servers.
While WP mobile phones are in C/S mode, Microsoft does not allow mobile phones to passively receive messages from servers, but server notifications cannot be implemented in this way. Therefore, WP provides a proxy mechanism to implement server notifications, which is push notifications. Push notification is an ECS proxy. The server cannot send messages directly to the mobile client and must send messages through the ECS proxy.
The official process of the push mechanism in msdn is as follows:
Displays the main process of pushing notifications.
Step 1: push client services from client applications running on mobile phones (1)
Request push notification Uri.
Steps 2 and 3: Push Client Services and Microsoft
The push notification service (mpns) negotiates and returns a notification URI to the client application (2 and 3.
Step 4: The client application sends this URI to cloud service (4 ).
Step 5: When the Web Service has information to send to the client application, the Service uses this URI to send push notifications to the Microsoft Notification Service (5.
Step 6: The Microsoft push notification service sends the push notification to an application running on a Windows Phone device (6.
Based on the push notification format and the load connected to the notification, the information is visually updated or toast notification is displayed as raw data sent to the application and application tile. After a push notification is sent, the Microsoft push notification service sends a response code to your web service, indicating that this notification has been received and will be sent to the device next time. However, the Microsoft push notification service does not provide end-to-end communication for sending push notifications from the Web service to devices.
Ii. WP push notification types
Windows Phone has three default notification types: Tile, push, and toast.
1. tile notification
Tile can be set for each application. tile is a visual and dynamic representation of the application content. When the application is fixed to the Start Screen, we can see the tile information. The three elements that tile can modify include: Count, title, and background ).
2. Toast notification
The toast notification is a Windows Phone notification. It does not destroy the user's workflow and disappears automatically in 10 seconds. The toast notification is displayed at the top of the screen.
Two text elements of a toast notification: The title and subtitle. The title is a string displayed in bold Chinese, and the subtitle is a string not displayed in bold Chinese.
In the toast notification, the data sent is in the specified XML format. If the application is running, the content is sent to the application. If the application is not running, a message is displayed in the TOST message box.
Important: |
The application must be authorized by the user to receive the toast notification, and the application must have the toast notification function that allows the user to disable. |
3. Raw notification
Raw notification has several features: (1) the raw notification format can be set at will, that is, the PUSH Service can send data in any format. (2) This type of data should be sent only when the application is running. If your application is not running, the raw notification will be discarded by the Microsoft push notification service and will not be passed to the Windows Phone device. (3) The program can process data as needed. (4) The maximum payload of raw notifications is 1 kb.
3. Select the push notification type
Notification is an important part of user experience. developers need to carefully consider how to use it. Duplicate or intrusive notifications reduce the performance of your applications and other programs running on your devices. These notifications will also disturb users. Therefore, developers need to consider the frequency of sending notifications and the types of events that require user attention.
Push Notification Type |
Application Example |
Tile notification |
Such as the information notification of temperature changes in weather applications. |
Toast notification |
View it immediately, such as important notifications of sudden news. |
Raw notification |
Send information directly to your application in a custom format. |
========================================================== ====================================
Note: I have prepared several documents above and would like to share them with you. (Mo)