Windows Phone 7Li Jingnan / Wang Tao2011-7-151
2 days2
aboutanytao| Ethos<ethos:Member   id = “Wang Tao”   msn = anytao@live.comweibo = http://weibo.com/anytaorunat = “Senior System Architect”/>Jason | Ethos<ethos:Member   id = “Li Jingnan”   msn = zengnami@hotmail.comweibo= http://weibo.com/jn1981runat = “SE”/>
abouthttp://book.anytao.net
08 Push NotificationWang Tao / 2011-07-15
Session Outlineoverviewtitlestoastrawnotification service
3 kinds of notificationsRawnotification message content is app-specificdelivered directly to app only if it’s runningToastspecific xml schemaContent delivered to app if it’s runningIf app is not running, system displays Toast popup using notification message contentTilespecific xml schemaNever delivered to appIf user has pinned to app tile, system updates it using notification message content7
RawRawupdates it using notification message content8
Toast9
Tile10
What  is  Push ?
Push  VS  PullServer-PushClient-Pull
push notification(PN)WP7提供的一种允许服务器主动向WP7客户端直接发送通知的机制服务器端主动发起发送的是“通知”避免了Client-Pull通信模式的中多次轮询更省电更省网络流量给用户制造一种“多任务”的感觉便于创建高互动性的WP7网络应用程序(如IM)13
3 notificationsTile Notification效果:更新Tile(瓷片)显示格式:特定格式XML片段无论应用程序当前是否运行都接收Toast Notification效果:弹出Toast提示,用户可点击以启动应用程序格式:特定格式XML片段只有当应用程序未运行时才接收RAW Notification效果:由应用程序控制格式:自由格式二进制序列只有当应用程序正在运行时才接收14
3 notifications1415New photos online!Seattle, WA: Sunny and 85 degrees15
contentSub-TitleTitle16
PN & battery低电量状态只发送RAW通知MPNS将根据设备电量状态决定是否将通知发送到设备正常电量状态发送所有通知极低电量状态不发送任何通知17
PNbasicClient:Windows Phone DeviceMicrosoft Push Notification Service (MPNS) Provider:Web Application /Cloud Service18
PN processPush clientTileToastOpen ChanelAppOpen push channelReturn URIData to toastData to tileData to AppReturn Chanel URIMPNSYour serviceSend URI to serverEventSend push data to client19Send push data to URI
PN program model建立服务端Web Service。功能:a)接收客户端Chanle  URI并保存在列表中b)向MPN S发送通知建立WP7客户端端应用程序。功能:a)向MPNS注册Chanelb)将Chanel URI提交给服务端c)接收通知并处理、显示20
send notification// <Notification Channel URI>在Chanel创建时由MPNS生成,是Chanel的唯一标识stringsubscriptionUri = "<Notification Channel URI>";HttpWebRequestsendNotificationRequest = (HttpWebRequest)WebRequest.Create(subscriptionUri); //必须使用POST方法发送通知sendNotificationRequest.Method= "POST"; // 添加HTTP头X-MessageID作为消息标识(可选)sendNotificationRequest.Headers.Add("X-MessageID", "<UUID>"); sendNotificationRequest.ContentLength= notificationMessage.Length; // 设置要发送的通知内容<payload>byte[] notificationMessage = new byte[] {<payload>}; using(Stream requestStream = sendNotificationRequest.GetRequestStream()) { requestStream.Write(notificationMessage, 0, notificationMessage.Length); } //向MPNS发送通知并获取响应HttpWebResponseresponse = (HttpWebResponse)sendNotificationRequest.GetResponse(); //从响应的HTTP头中提取相关结果stringnotificationStatus = response.Headers["X-NotificationStatus"]; stringnotificationChannelStatus = response.Headers["X-SubscriptionStatus"]; stringdeviceConnectionStatus = response.Headers["X-DeviceConnectionStatus"];21
tile notificationsendNotificationRequest.ContentType = "text/xml";sendNotificationRequest.Headers.Add("X-WindowsPhone-Target", "token");sendNotificationRequest.Headers.Add("X-NotificationClass", “1"); 22tilenotification HTTPheadertilenotification contentstring tileMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +"<wp:Notificationxmlns:wp=\"WPNotification\">" +   "<wp:Tile>" +      "<wp:BackgroundImage><background image path></wp:BackgroundImage>" +      "<wp:Count><count></wp:Count>" +      "<wp:Title><title></wp:Title>" +   "</wp:Tile> " +"</wp:Notification>";
toastsendNotificationRequest.ContentType = "text/xml";sendNotificationRequest.Headers.Add("X-WindowsPhone-Target", "toast");sendNotificationRequest.Headers.Add("X-NotificationClass", “1");23Toast http headerToast contentstring toastMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +"<wp:Notificationxmlns:wp=\"WPNotification\">" +   "<wp:Toast>" +      "<wp:Text1><string></wp:Text1>" +      "<wp:Text2><string></wp:Text2>" +   "</wp:Toast>" +"</wp:Notification>";
send notification// <Notification Channel URI>在Chanel创建时由MPNS生成,是Chanel的唯一标识stringsubscriptionUri = "<Notification Channel URI>";HttpWebRequestsendNotificationRequest = (HttpWebRequest)WebRequest.Create(subscriptionUri); //必须使用POST方法发送通知sendNotificationRequest.Method= "POST"; // 添加HTTP头X-MessageID作为消息标识(可选)sendNotificationRequest.Headers.Add("X-MessageID", "<UUID>"); sendNotificationRequest.ContentLength= notificationMessage.Length; // 设置要发送的通知内容<payload>byte[] notificationMessage = new byte[] {<payload>}; using(Stream requestStream = sendNotificationRequest.GetRequestStream()) { requestStream.Write(notificationMessage, 0, notificationMessage.Length); } //向MPNS发送通知并获取响应HttpWebResponseresponse = (HttpWebResponse)sendNotificationRequest.GetResponse(); //从响应的HTTP头中提取相关结果stringnotificationStatus = response.Headers["X-NotificationStatus"]; stringnotificationChannelStatus = response.Headers["X-SubscriptionStatus"]; stringdeviceConnectionStatus = response.Headers["X-DeviceConnectionStatus"];24
raw  notificaitionsendNotificationRequest.Headers.Add("X-NotificationClass", “1");25RAW http headerRAWhttp contentnew byte[] {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
demo26/ title/ toast/ raw/ notification service04 notification
thank you27thank youwww.anytao.com
28

More Related Content

PDF
Setup vpn on window 10
PPTX
Windows Phone 8 - 9 Push Notifications
PDF
08.Push Notifications
PDF
follow-app BOOTCAMP 2 - Windows Phone: Tiles and Notifications
PPTX
Engaging users with live tiles and notifications
PPTX
Live Tiles and Notifications in Windows Phone
PPTX
Windows 8 metro applications
PPTX
14 tiles, notifications, and action center
Setup vpn on window 10
Windows Phone 8 - 9 Push Notifications
08.Push Notifications
follow-app BOOTCAMP 2 - Windows Phone: Tiles and Notifications
Engaging users with live tiles and notifications
Live Tiles and Notifications in Windows Phone
Windows 8 metro applications
14 tiles, notifications, and action center

Similar to 08 wp7 push notification (10)

PDF
SeaBeyond 2011 ProcessOne - Nokia: Jukka Alakontiola - Notifications API
PPTX
Net campus15 notification-hub
PPTX
AZURE NOTIFICATION HUB
PPTX
Techdays 2012 - Windows Phone Push notifications & Life tiles
PPTX
Sviluppare una live app: notifiche, live tile, lock screen
PDF
Push to Me: Mobile Push Notifications (Zend Framework)
PPTX
WP8.1 Tiles and Notifications
PDF
Zend Framework Push Notifications
PDF
Mobile Push Notifications
PDF
Leveraging Zend Framework for Sending Push Notifications
SeaBeyond 2011 ProcessOne - Nokia: Jukka Alakontiola - Notifications API
Net campus15 notification-hub
AZURE NOTIFICATION HUB
Techdays 2012 - Windows Phone Push notifications & Life tiles
Sviluppare una live app: notifiche, live tile, lock screen
Push to Me: Mobile Push Notifications (Zend Framework)
WP8.1 Tiles and Notifications
Zend Framework Push Notifications
Mobile Push Notifications
Leveraging Zend Framework for Sending Push Notifications
Ad

More from Tao Wang (20)

PDF
团队高效沟通的秘密
PDF
高效团队的秘密
PDF
Worktile 更好用的企业协作平台
PDF
Hello, Worktile Pro
PDF
Windows Phone 7 in azure
PDF
Anytao 让windows phone应用在云端翱翔
PPTX
13 wp7 working with azure
PPTX
12 wp7 marketing windows phone applications
PPTX
11 wp7 designing applicationsusingexpressionblend
PPTX
10 wp7 local database
PPTX
09 wp7 multitasking
PPTX
08 wp7 push notification
PPTX
07 wp7 application lifecycle
PPTX
06 wp7 isolation storage
PPTX
03 wp7 application bar
PPTX
03 wp7 application bar
PPTX
05 wp7 launchers and choosers
PPTX
04 wp7 pivot and panorama
PPTX
02 wp7 building silverlight applications
PPTX
01 wp7 introduction
团队高效沟通的秘密
高效团队的秘密
Worktile 更好用的企业协作平台
Hello, Worktile Pro
Windows Phone 7 in azure
Anytao 让windows phone应用在云端翱翔
13 wp7 working with azure
12 wp7 marketing windows phone applications
11 wp7 designing applicationsusingexpressionblend
10 wp7 local database
09 wp7 multitasking
08 wp7 push notification
07 wp7 application lifecycle
06 wp7 isolation storage
03 wp7 application bar
03 wp7 application bar
05 wp7 launchers and choosers
04 wp7 pivot and panorama
02 wp7 building silverlight applications
01 wp7 introduction
Ad

Recently uploaded (20)

PPT
What is a Computer? Input Devices /output devices
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
A novel scalable deep ensemble learning framework for big data classification...
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Hybrid model detection and classification of lung cancer
PDF
CloudStack 4.21: First Look Webinar slides
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PPTX
observCloud-Native Containerability and monitoring.pptx
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
1 - Historical Antecedents, Social Consideration.pdf
PPTX
Modernising the Digital Integration Hub
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
Getting started with AI Agents and Multi-Agent Systems
PPTX
Chapter 5: Probability Theory and Statistics
PDF
August Patch Tuesday
PPTX
Benefits of Physical activity for teenagers.pptx
PDF
Developing a website for English-speaking practice to English as a foreign la...
What is a Computer? Input Devices /output devices
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
A novel scalable deep ensemble learning framework for big data classification...
Final SEM Unit 1 for mit wpu at pune .pptx
Assigned Numbers - 2025 - Bluetooth® Document
Hybrid model detection and classification of lung cancer
CloudStack 4.21: First Look Webinar slides
O2C Customer Invoices to Receipt V15A.pptx
observCloud-Native Containerability and monitoring.pptx
Enhancing emotion recognition model for a student engagement use case through...
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
1 - Historical Antecedents, Social Consideration.pdf
Modernising the Digital Integration Hub
NewMind AI Weekly Chronicles – August ’25 Week III
Getting started with AI Agents and Multi-Agent Systems
Chapter 5: Probability Theory and Statistics
August Patch Tuesday
Benefits of Physical activity for teenagers.pptx
Developing a website for English-speaking practice to English as a foreign la...

08 wp7 push notification