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

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
 
SMSInterface_Old2New
SMSInterface_Old2NewSMSInterface_Old2New
SMSInterface_Old2Newinforumobile
 

Semelhante a 08 wp7 push notification (20)

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
 
SMSInterface_Old2New
SMSInterface_Old2NewSMSInterface_Old2New
SMSInterface_Old2New
 

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

Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 

Último (20)

Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 

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