Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Oliver Scheer
Senior Technical Evangelist
Microsoft Deutschland
http://the-oliver.com
Push Notifications
Push
Notifications
3/18/2014
Push Notifications and Live Tiles
• Push Notifications offer developers a way to send timely
information relating to their...
Push Notifications
Server-initiated communication
Enable key background scenarios
Preserve battery life and user experienc...
Three Kinds of Notifications
• Raw
• Notification message content is application-specific
• Delivered directly to app only...
Push Notification Data Flow
URI to the service:
"http://notify.live.com/throttledthirdparty/01.00/AAFRQHgiiMWNTYrRD
XAHQtz...
Push Notification Features
• Tile updates can update any display element of each of the Tile templates
• Be careful to dow...
Toast Message Content
•Used by system to display Toast message if app not running
•Navigates to page specified in <Param> ...
Toast Message Content
• Use the following HTTP headers:
• Where <batching interval> is 3 – Immediate delivery, 13 – delive...
Tile Message Content
10
• Tile messages are never delivered to the app
• There are specific schemas for the a Tile update ...
FlipTile Template Tile Message Schema
<?xml version="1.0"?>
<wp:Notification xmlns:wp="WPNotification" Version="2.0">
<wp:...
CycleTile Template Tile Message Schema
<?xml version="1.0"?>
<wp:Notification xmlns:wp="WPNotification" Version="2.0">
<wp...
IconicTile Template Tile Message Schema
<?xml version="1.0"?>
<wp:Notification xmlns:wp="WPNotification" Version="2.0">
<w...
Raw Message Content
• Use the following HTTP headers:
• Where <batching interval> is 3 – Immediate delivery, 13 – delivere...
Demo:
Push Notifications
15
Response Custom Headers
• Response Code: HTTP status code (200 OK)
• Notification Status
• Notification received by the Pu...
Review
• Push Notifications are an efficient and battery-friendly way of sending notifications from a
server to an app on ...
The information herein is for informational
purposes only an represents the current view of
Microsoft Corporation as of th...
Upcoming SlideShare
Loading in …5
×

Windows Phone 8 - 9 Push Notifications

1,340 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Windows Phone 8 - 9 Push Notifications

  1. 1. Oliver Scheer Senior Technical Evangelist Microsoft Deutschland http://the-oliver.com Push Notifications
  2. 2. Push Notifications 3/18/2014
  3. 3. Push Notifications and Live Tiles • Push Notifications offer developers a way to send timely information relating to their applications even when they are not running + • Windows phone has the unique ability to provide the end user glanceable access to the information they care most about, via Live Tiles
  4. 4. Push Notifications Server-initiated communication Enable key background scenarios Preserve battery life and user experience Prevent polling for updates
  5. 5. Three Kinds of Notifications • Raw • Notification message content is application-specific • Delivered directly to app only if it is running • Toast • Specific XML schema • Content delivered to app if it is running • If app is not running, system displays Toast popup using notification message content • Tile • Specific XML schema • Never delivered to app • If the Tile is currently pinned to the Start screen, system updates it using notification message content 5
  6. 6. Push Notification Data Flow URI to the service: "http://notify.live.com/throttledthirdparty/01.00/AAFRQHgiiMWNTYrRD XAHQtz-AgrNpzcDAwAAAAQOMDAwMDAwMDAwMDAwMDA" Push enabled applications Notifications service HTTP POST the message Push endpoint is established. URI is created for the endpoint. 1 2 3 Third-party service MPNS: Microsoft hosted server Send PN Message 4
  7. 7. Push Notification Features • Tile updates can update any display element of each of the Tile templates • Be careful to downgrade updates sent to 7.1 clients • 30 subscription endpoints allowed per phone • Maximum size of a notification is 1KB for the header and 3KB for the payload. • Unauthenticated Web Service limited to 500 push notifications per subscription per day • Authenticated Web Services are recommended • Communication uses HTTPS channel • No limit • Able to register a callback request
  8. 8. Toast Message Content •Used by system to display Toast message if app not running •Navigates to page specified in <Param> (if supplied) •If app is already running • ShellToastNotificationReceived event fires • <Text1> and <Text2> values in event args as Dictionary<string, string> 8
  9. 9. Toast Message Content • Use the following HTTP headers: • Where <batching interval> is 3 – Immediate delivery, 13 – delivered within 450 seconds, 23 – delivered within 900 seconds 9 string toastMessage = "<?xml version="1.0" encoding="utf-8"?>" + "<wp:Notification xmlns:wp="WPNotification">" + "<wp:Toast>" + "<wp:Text1>WEATHER ALERT</wp:Text1>" + "<wp:Text2>Stormy</wp:Text2>" + "<wp:Param>/page1.xaml?value1=1234<wp:Param>" + "</wp:Toast>" + "</wp:Notification>"; sendNotificationRequest.ContentType = "text/xml"; sendNotificationRequest.Headers.Add("X-WindowsPhone-Target", "toast"); sendNotificationRequest.Headers.Add("X-NotificationClass", "<batching interval>");
  10. 10. Tile Message Content 10 • Tile messages are never delivered to the app • There are specific schemas for the a Tile update message for each of the three Tile Templates: Flip, Cycle and Iconic • Only Tiles using Flip and Iconic templates can be updated with images at remote URLs • Remote Images limited to 80KB and must download in 30 seconds or less • V7.x clients cannot consume these new templates. Recommend you: • In your app, capture the device unique ID, the push URI, the OS version and the app version. Send this data to your Web service registration method • Make sure you only send the new templates to compatible new OS versions/app versions! • Use the following HTTP headers: sendNotificationRequest.ContentType = "text/xml"; sendNotificationRequest.Headers.Add("X-WindowsPhone-Target", “token"); sendNotificationRequest.Headers.Add("X-NotificationClass", "<batching interval>");
  11. 11. FlipTile Template Tile Message Schema <?xml version="1.0"?> <wp:Notification xmlns:wp="WPNotification" Version="2.0"> <wp:Tile Id="[TileId]" Template="FlipTile"> <wp:SmallBackgroundImage Action="Clear">[sm tile img URI]</wp:SmallBackgroundImage> <wp:WideBackgroundImage Action="Clear">[front of wd tile img URI]</wp:WideBackgroundImage> <wp:WideBackBackgroundImage Action="Clear">[back of wd tile img URI]</wp:WideBackBackgroundImage> <wp:WideBackContent Action="Clear">[back of wd tile content text]</wp:WideBackContent> <wp:BackgroundImage Action="Clear">[front of med tile img URI]</wp:BackgroundImage> <wp:Count Action="Clear">[count]</wp:Count> <wp:Title Action="Clear">[title text]</wp:Title> <wp:BackBackgroundImage Action="Clear">[back of med tile img URI]</wp:BackBackgroundImage> <wp:BackTitle Action="Clear">[back of tile title text]</wp:BackTitle> <wp:BackContent Action="Clear">[back of med tile content text]</wp:BackContent> </wp:Tile> </wp:Notification> 3/18/201411
  12. 12. CycleTile Template Tile Message Schema <?xml version="1.0"?> <wp:Notification xmlns:wp="WPNotification" Version="2.0"> <wp:Tile Id="[TileId]" Template="CycleTile"> <wp:SmallBackgroundImage Action="Clear">[sm tile img URI]</wp:SmallBackgroundImage> <wp:CycleImage1 Action="Clear">[photo 1 img URI]</wp:CycleImage1> <wp:CycleImage2 Action="Clear">[photo 2 img URI]</wp:CycleImage2> <wp:CycleImage3 Action="Clear">[photo 3 img URI]</wp:CycleImage3> <wp:CycleImage4 Action="Clear">[photo 4 img URI]</wp:CycleImage4> <wp:CycleImage5 Action="Clear">[photo 5 img URI]</wp:CycleImage5> <wp:CycleImage6 Action="Clear">[photo 6 img URI]</wp:CycleImage6> <wp:CycleImage7 Action="Clear">[photo 7 img URI]</wp:CycleImage7> <wp:CycleImage8 Action="Clear">[photo 8 img URI]</wp:CycleImage8> <wp:CycleImage9 Action="Clear">[photo 9 img URI]</wp:CycleImage9> <wp:Count Action="Clear">[count]</wp:Count> <wp:Title Action="Clear">[title text]</wp:Title> </wp:Tile> </wp:Notification> 3/18/201412
  13. 13. IconicTile Template Tile Message Schema <?xml version="1.0"?> <wp:Notification xmlns:wp="WPNotification" Version="2.0"> <wp:Tile Id="[TileId]" Template="IconicTile"> <wp:SmallIconImage Action="Clear">[sm icon img URI]</wp:SmallIconImage> <wp:IconImage Action="Clear">[med/wd icon img URI]</wp:IconImage> <wp:WideContent1 Action="Clear">[wd tile content line 1]</wp:WideContent1> <wp:WideContent2 Action="Clear">[wd tile content line 2]</wp:WideContent2> <wp:WideContent3 Action="Clear">[wd tile content line 3]</wp:WideContent3> <wp:Count Action="Clear">[count]</wp:Count> <wp:Title Action="Clear">[title text]</wp:Title> <wp:BackgroundColor Action="Clear">[hex ARGB background color of tile]</wp:BackgroundColor> </wp:Tile> </wp:Notification> 3/18/201413
  14. 14. Raw Message Content • Use the following HTTP headers: • Where <batching interval> is 3 – Immediate delivery, 13 – delivered within 450 seconds, 23 – delivered within 900 seconds • Message Content is application-specific – only gets delivered to running app • For example use XML to format data 14 string tileMessage = "<?xml version="1.0" encoding="utf-8"?>" + "<root>" + "<Value1>SomeUserValue<Value1>" + "<Value2>SomeOtherUserValue<Value2>" + "</root>"; sendNotificationRequest.ContentType = "text/xml"; sendNotificationRequest.Headers.Add("X-NotificationClass", "<batching interval>");
  15. 15. Demo: Push Notifications 15
  16. 16. Response Custom Headers • Response Code: HTTP status code (200 OK) • Notification Status • Notification received by the Push Notification Service • For example: “X-NotificationStatus:Received” • DeviceConnectionStatus • The connection status of the device • //For example: X-DeviceConnectionStatus:Connected • SubscriptionStatus • The subscription status • //For example: X-SubscriptionStatus:Active • More information • http://msdn.microsoft.com/en-us/library/ff402545(v=VS.92).aspx
  17. 17. Review • Push Notifications are an efficient and battery-friendly way of sending notifications from a server to an app on a phone • Raw notifications go only to a running app • Toast notifications go to the app if it is running, otherwise display as a popup on the phone • Tile notifications are used only to update tiles on the Start Screen
  18. 18. The information herein is for informational purposes only an represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

×