SlideShare uma empresa Scribd logo
1 de 28
Windows Phone 7 Li Jingnan / Wang Tao 2011-7-15 1
2 days 2
about anytao| Ethos <ethos:Member    id = “Wang Tao”    msn = anytao@live.com weibo = http://weibo.com/anytao runat = “Senior System Architect” /> Jason | Ethos <ethos:Member    id = “Li Jingnan”    msn = zengnami@hotmail.com weibo= http://weibo.com/jn1981 runat = “SE” />
about http://book.anytao.net
08 Push Notification Wang Tao / 2011-07-15
Session Outline overview titles toast raw notification service
3 kinds of notifications Raw notification message content is app-specific delivered directly to app only if it’s running Toast specific xml schema Content delivered to app if it’s running If app is not running, system displays Toast popup using notification message content Tile specific xml schema Never delivered to app If user has pinned to app tile, system updates it using notification message content 7
Raw Raw updates it using notification message content 8
Toast 9
Tile 10
What  is  Push ?
Push  VS  Pull Server-Push Client-Pull
push notification(PN) WP7提供的一种允许服务器主动向WP7客户端直接发送通知的机制 服务器端主动发起 发送的是“通知” 避免了Client-Pull通信模式的中多次轮询 更省电 更省网络流量 给用户制造一种“多任务”的感觉 便于创建高互动性的WP7网络应用程序(如IM) 13
3 notifications Tile Notification 效果:更新Tile(瓷片)显示 格式:特定格式XML片段 无论应用程序当前是否运行都接收 Toast Notification 效果:弹出Toast提示,用户可点击以启动应用程序 格式:特定格式XML片段 只有当应用程序未运行时才接收 RAW Notification 效果:由应用程序控制 格式:自由格式二进制序列 只有当应用程序正在运行时才接收 14
3 notifications 14 15 New photos online! Seattle, WA: Sunny and 85 degrees 15
content Sub-Title Title 16
PN & battery 低电量状态 只发送RAW通知 MPNS将根据设备电量状态决定是否将通知发送到设备 正常电量状态 发送所有通知 极低电量状态 不发送任何通知 17
PNbasic Client: Windows Phone Device Microsoft Push Notification Service (MPNS)  Provider: Web Application / Cloud Service 18
PN process Push client Tile Toast Open Chanel App Open push channel Return URI Data to toast Data to tile Data to App Return Chanel URI MPNS Your service Send URI to server Event Send push data to client 19 Send push data to URI
PN program model 建立服务端Web Service。 功能: a)接收客户端Chanle  URI并保存在列表中 b)向MPN S发送通知 建立WP7客户端端应用程序。 功能: a)向MPNS注册Chanel b)将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 notification sendNotificationRequest.ContentType = "text/xml"; sendNotificationRequest.Headers.Add("X-WindowsPhone-Target", "token"); sendNotificationRequest.Headers.Add("X-NotificationClass", “1");  22 tilenotification HTTPheader tilenotification content string tileMessage = "<?xml version=quot;1.0quot; encoding=quot;utf-8quot;?>" + "<wp:Notificationxmlns:wp=quot;WPNotificationquot;>" +    "<wp:Tile>" +       "<wp:BackgroundImage><background image path></wp:BackgroundImage>" +       "<wp:Count><count></wp:Count>" +       "<wp:Title><title></wp:Title>" +    "</wp:Tile> " + "</wp:Notification>";
toast sendNotificationRequest.ContentType = "text/xml"; sendNotificationRequest.Headers.Add("X-WindowsPhone-Target", "toast"); sendNotificationRequest.Headers.Add("X-NotificationClass", “1"); 23 Toast http header Toast content string toastMessage = "<?xml version=quot;1.0quot; encoding=quot;utf-8quot;?>" + "<wp:Notificationxmlns:wp=quot;WPNotificationquot;>" +    "<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  notificaition sendNotificationRequest.Headers.Add("X-NotificationClass", “1"); 25 RAW http header RAWhttp content new byte[] {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
demo 26 / title / toast / raw / notification service 04 notification
thank you 27 thank youwww.anytao.com
28

Mais conteúdo relacionado

Semelhante a 08 wp7 push notification

Android notification
Android notificationAndroid notification
Android notificationKrazy Koder
 
follow-app BOOTCAMP 2 - Windows Phone: Tiles and Notifications
follow-app BOOTCAMP 2 - Windows Phone: Tiles and Notifications follow-app BOOTCAMP 2 - Windows Phone: Tiles and Notifications
follow-app BOOTCAMP 2 - Windows Phone: Tiles and Notifications QIRIS
 
IntegrationBroker
IntegrationBrokerIntegrationBroker
IntegrationBrokermeghamystic
 
08.Push Notifications
08.Push Notifications 08.Push Notifications
08.Push Notifications Nguyen Tuan
 
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...Frédéric Harper
 
Html5 localstorage attack vectors
Html5 localstorage attack vectorsHtml5 localstorage attack vectors
Html5 localstorage attack vectorsShreeraj Shah
 
Azure + WP7 - CodePaLOUsa
Azure + WP7 - CodePaLOUsaAzure + WP7 - CodePaLOUsa
Azure + WP7 - CodePaLOUsaSam Basu
 
Let's Peel Mangos
Let's Peel MangosLet's Peel Mangos
Let's Peel MangosSam Basu
 
Azure & WP7 at GRDevDay
Azure & WP7 at GRDevDayAzure & WP7 at GRDevDay
Azure & WP7 at GRDevDaySam Basu
 
Petr Dvořák: Mobilní webové služby pohledem iPhone developera
Petr Dvořák: Mobilní webové služby pohledem iPhone developeraPetr Dvořák: Mobilní webové služby pohledem iPhone developera
Petr Dvořák: Mobilní webové služby pohledem iPhone developeraWebExpo
 
The Windows Runtime and the Web
The Windows Runtime and the WebThe Windows Runtime and the Web
The Windows Runtime and the WebJeremy Likness
 
XST - Cross Site Tracing
XST - Cross Site TracingXST - Cross Site Tracing
XST - Cross Site TracingMagno Logan
 
Employee_Resume_Rex Leo_M1011953
Employee_Resume_Rex Leo_M1011953Employee_Resume_Rex Leo_M1011953
Employee_Resume_Rex Leo_M1011953Rex Leo
 

Semelhante a 08 wp7 push notification (20)

Android notification
Android notificationAndroid notification
Android notification
 
follow-app BOOTCAMP 2 - Windows Phone: Tiles and Notifications
follow-app BOOTCAMP 2 - Windows Phone: Tiles and Notifications follow-app BOOTCAMP 2 - Windows Phone: Tiles and Notifications
follow-app BOOTCAMP 2 - Windows Phone: Tiles and Notifications
 
Windows 8 BootCamp
Windows 8 BootCampWindows 8 BootCamp
Windows 8 BootCamp
 
IntegrationBroker
IntegrationBrokerIntegrationBroker
IntegrationBroker
 
Cgi
CgiCgi
Cgi
 
OneTeam Media Server
OneTeam Media ServerOneTeam Media Server
OneTeam Media Server
 
08.Push Notifications
08.Push Notifications 08.Push Notifications
08.Push Notifications
 
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
 
Html5 localstorage attack vectors
Html5 localstorage attack vectorsHtml5 localstorage attack vectors
Html5 localstorage attack vectors
 
Azure + WP7 - CodePaLOUsa
Azure + WP7 - CodePaLOUsaAzure + WP7 - CodePaLOUsa
Azure + WP7 - CodePaLOUsa
 
Let's Peel Mangos
Let's Peel MangosLet's Peel Mangos
Let's Peel Mangos
 
Bot builder v4 HOL
Bot builder v4 HOLBot builder v4 HOL
Bot builder v4 HOL
 
Azure & WP7 at GRDevDay
Azure & WP7 at GRDevDayAzure & WP7 at GRDevDay
Azure & WP7 at GRDevDay
 
Petr Dvořák: Mobilní webové služby pohledem iPhone developera
Petr Dvořák: Mobilní webové služby pohledem iPhone developeraPetr Dvořák: Mobilní webové služby pohledem iPhone developera
Petr Dvořák: Mobilní webové služby pohledem iPhone developera
 
- Webexpo 2010
- Webexpo 2010- Webexpo 2010
- Webexpo 2010
 
The Windows Runtime and the Web
The Windows Runtime and the WebThe Windows Runtime and the Web
The Windows Runtime and the Web
 
XST - Cross Site Tracing
XST - Cross Site TracingXST - Cross Site Tracing
XST - Cross Site Tracing
 
How to build typing indicator in a Chat app
How to build typing indicator in a Chat appHow to build typing indicator in a Chat app
How to build typing indicator in a Chat app
 
Employee_Resume_Rex Leo_M1011953
Employee_Resume_Rex Leo_M1011953Employee_Resume_Rex Leo_M1011953
Employee_Resume_Rex Leo_M1011953
 
OneTeam Media Server
OneTeam Media ServerOneTeam Media Server
OneTeam Media Server
 

Mais de Tao Wang

团队高效沟通的秘密
团队高效沟通的秘密团队高效沟通的秘密
团队高效沟通的秘密Tao Wang
 
高效团队的秘密
高效团队的秘密高效团队的秘密
高效团队的秘密Tao Wang
 
Worktile 更好用的企业协作平台
Worktile   更好用的企业协作平台Worktile   更好用的企业协作平台
Worktile 更好用的企业协作平台Tao Wang
 
Hello, Worktile Pro
Hello, Worktile ProHello, Worktile Pro
Hello, Worktile ProTao Wang
 
Windows Phone 7 in azure
Windows Phone 7 in azureWindows Phone 7 in azure
Windows Phone 7 in azureTao Wang
 
Anytao 让windows phone应用在云端翱翔
Anytao 让windows phone应用在云端翱翔Anytao 让windows phone应用在云端翱翔
Anytao 让windows phone应用在云端翱翔Tao Wang
 
13 wp7 working with azure
13 wp7   working with azure13 wp7   working with azure
13 wp7 working with azureTao Wang
 
12 wp7 marketing windows phone applications
12 wp7   marketing windows phone applications12 wp7   marketing windows phone applications
12 wp7 marketing windows phone applicationsTao Wang
 
11 wp7 designing applicationsusingexpressionblend
11 wp7   designing applicationsusingexpressionblend11 wp7   designing applicationsusingexpressionblend
11 wp7 designing applicationsusingexpressionblendTao Wang
 
10 wp7 local database
10 wp7   local database10 wp7   local database
10 wp7 local databaseTao Wang
 
09 wp7 multitasking
09 wp7   multitasking09 wp7   multitasking
09 wp7 multitaskingTao Wang
 
08 wp7 push notification
08 wp7   push notification08 wp7   push notification
08 wp7 push notificationTao Wang
 
07 wp7 application lifecycle
07 wp7   application lifecycle07 wp7   application lifecycle
07 wp7 application lifecycleTao Wang
 
06 wp7 isolation storage
06 wp7   isolation storage06 wp7   isolation storage
06 wp7 isolation storageTao Wang
 
03 wp7 application bar
03 wp7   application bar03 wp7   application bar
03 wp7 application barTao Wang
 
03 wp7 application bar
03 wp7   application bar03 wp7   application bar
03 wp7 application barTao Wang
 
05 wp7 launchers and choosers
05 wp7   launchers and choosers05 wp7   launchers and choosers
05 wp7 launchers and choosersTao Wang
 
04 wp7 pivot and panorama
04 wp7   pivot and panorama04 wp7   pivot and panorama
04 wp7 pivot and panoramaTao Wang
 
02 wp7 building silverlight applications
02 wp7   building silverlight applications02 wp7   building silverlight applications
02 wp7 building silverlight applicationsTao Wang
 
01 wp7 introduction
01 wp7   introduction01 wp7   introduction
01 wp7 introductionTao Wang
 

Mais de Tao Wang (20)

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

Último

WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 

Último (20)

WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 

08 wp7 push notification

  • 1. Windows Phone 7 Li Jingnan / Wang Tao 2011-7-15 1
  • 3. about anytao| Ethos <ethos:Member id = “Wang Tao” msn = anytao@live.com weibo = http://weibo.com/anytao runat = “Senior System Architect” /> Jason | Ethos <ethos:Member id = “Li Jingnan” msn = zengnami@hotmail.com weibo= http://weibo.com/jn1981 runat = “SE” />
  • 5. 08 Push Notification Wang Tao / 2011-07-15
  • 6. Session Outline overview titles toast raw notification service
  • 7. 3 kinds of notifications Raw notification message content is app-specific delivered directly to app only if it’s running Toast specific xml schema Content delivered to app if it’s running If app is not running, system displays Toast popup using notification message content Tile specific xml schema Never delivered to app If user has pinned to app tile, system updates it using notification message content 7
  • 8. Raw Raw updates it using notification message content 8
  • 11. What is Push ?
  • 12. Push VS Pull Server-Push Client-Pull
  • 13. push notification(PN) WP7提供的一种允许服务器主动向WP7客户端直接发送通知的机制 服务器端主动发起 发送的是“通知” 避免了Client-Pull通信模式的中多次轮询 更省电 更省网络流量 给用户制造一种“多任务”的感觉 便于创建高互动性的WP7网络应用程序(如IM) 13
  • 14. 3 notifications Tile Notification 效果:更新Tile(瓷片)显示 格式:特定格式XML片段 无论应用程序当前是否运行都接收 Toast Notification 效果:弹出Toast提示,用户可点击以启动应用程序 格式:特定格式XML片段 只有当应用程序未运行时才接收 RAW Notification 效果:由应用程序控制 格式:自由格式二进制序列 只有当应用程序正在运行时才接收 14
  • 15. 3 notifications 14 15 New photos online! Seattle, WA: Sunny and 85 degrees 15
  • 17. PN & battery 低电量状态 只发送RAW通知 MPNS将根据设备电量状态决定是否将通知发送到设备 正常电量状态 发送所有通知 极低电量状态 不发送任何通知 17
  • 18. PNbasic Client: Windows Phone Device Microsoft Push Notification Service (MPNS) Provider: Web Application / Cloud Service 18
  • 19. PN process Push client Tile Toast Open Chanel App Open push channel Return URI Data to toast Data to tile Data to App Return Chanel URI MPNS Your service Send URI to server Event Send push data to client 19 Send push data to URI
  • 20. PN program model 建立服务端Web Service。 功能: a)接收客户端Chanle URI并保存在列表中 b)向MPN S发送通知 建立WP7客户端端应用程序。 功能: a)向MPNS注册Chanel b)将Chanel URI提交给服务端 c)接收通知并处理、显示 20
  • 21. 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
  • 22. tile notification sendNotificationRequest.ContentType = "text/xml"; sendNotificationRequest.Headers.Add("X-WindowsPhone-Target", "token"); sendNotificationRequest.Headers.Add("X-NotificationClass", “1"); 22 tilenotification HTTPheader tilenotification content string tileMessage = "<?xml version=quot;1.0quot; encoding=quot;utf-8quot;?>" + "<wp:Notificationxmlns:wp=quot;WPNotificationquot;>" + "<wp:Tile>" + "<wp:BackgroundImage><background image path></wp:BackgroundImage>" + "<wp:Count><count></wp:Count>" + "<wp:Title><title></wp:Title>" + "</wp:Tile> " + "</wp:Notification>";
  • 23. toast sendNotificationRequest.ContentType = "text/xml"; sendNotificationRequest.Headers.Add("X-WindowsPhone-Target", "toast"); sendNotificationRequest.Headers.Add("X-NotificationClass", “1"); 23 Toast http header Toast content string toastMessage = "<?xml version=quot;1.0quot; encoding=quot;utf-8quot;?>" + "<wp:Notificationxmlns:wp=quot;WPNotificationquot;>" + "<wp:Toast>" + "<wp:Text1><string></wp:Text1>" + "<wp:Text2><string></wp:Text2>" + "</wp:Toast>" + "</wp:Notification>";
  • 24. 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
  • 25. raw notificaition sendNotificationRequest.Headers.Add("X-NotificationClass", “1"); 25 RAW http header RAWhttp content new byte[] {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
  • 26. demo 26 / title / toast / raw / notification service 04 notification
  • 27. thank you 27 thank youwww.anytao.com
  • 28. 28