+ All Categories
Home > Documents > Name Title Microsoft Corporation

Name Title Microsoft Corporation

Date post: 23-Feb-2016
Category:
Upload: onslow
View: 37 times
Download: 0 times
Share this document with a friend
Description:
Push Notification Introduction and Platform Interaction. Name Title Microsoft Corporation. Start Tiles 101. Shortcuts to apps. Static or dynamic. 2 sizes: small & large. “Pin to Start”. Data Driven Template Model. A fixed set of data properties. - PowerPoint PPT Presentation
21
Name Title Microsoft Corporation Push Notification Introduction and Platform Interaction
Transcript
Page 1: Name Title Microsoft Corporation

Name

Title

Microsoft Corporation

Push Notification Introduction and Platform Interaction

Page 2: Name Title Microsoft Corporation

2 Microsoft Confidential

Start Tiles 101Shortcuts to apps

Static or dynamic

2 sizes: small & large

“Pin to Start”

Page 3: Name Title Microsoft Corporation

3 Microsoft Confidential

Data Driven Template ModelA fixed set of data properties

Each property corresponds to an UI element

Each UI element has a fixed position on screen

Not all elements need to be used

Background Image

Title Count

Animations are not extensible

Page 4: Name Title Microsoft Corporation

4 Microsoft Confidential

Tile Design ConsiderationsEasy recognition

Keep things simple

Update tile in real-time

Page 5: Name Title Microsoft Corporation

5 Microsoft Confidential

Notification Toasts 101App icon + 2 text fields

Interruptive, transient and chase-able

Time critical and personally relevant

Users must opt-in via app UI

Page 6: Name Title Microsoft Corporation

6 Microsoft Confidential

Why does Push notifications give the end user great battery life?

How does Push notifications contribute to a deterministic behavior?

How does Push notifications change the developers design patterns?

Windows Push Notifications Introduction

Page 7: Name Title Microsoft Corporation

7 Microsoft Confidential

URI to the service:"http://notify.live.com/throttledthirdparty/

01.00/AAFRQHgiiMWNTYrRDXAHQtz-AgrNpzcDAwAAAAQOMDAwMDAwMDAwMDAw

MDA"Push enabled applications

Notifications service HTTP POST

the message

Push endpoint is established. URI is created for the endpoint.

1

2

3

Rich Client, Web 2.0 Applications

3rd party service

Microsofthosted server

Send PN Message

4

Page 8: Name Title Microsoft Corporation

Using PN from your Windows Phone application – Part #1 Try, Find, and New

httpChannel = HttpNotificationChannel.Find(channelName);if (null != httpChannel){ //subscribe to Channel events //subscribe to Notification events //Register URI}else ….

httpChannel = new HttpNotificationChannel(channelName, "HOLWeatherService");httpChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(httpChannel_ChannelUriUpdated);//subscribe to Channel eventshttpChannel.Open();//Register URI

Page 9: Name Title Microsoft Corporation

Using PN from your Windows Phone application – Part #1 Try, Find, and New

//Subscribe to the channel eventsprivate void SubscribeToChannelEvents(){ httpChannel.HttpNotificationReceived += new EventHandler <HttpNotificationEventArgs>

(httpChannel_HttpNotificationReceived);

httpChannel.ShellEntryPointNotificationReceived += new EventHandler <NotificationEventArgs> (httpChannel_ShellEntryPointNotificationReceived);

httpChannel.ShellNotificationReceived += new EventHandler <NotificationEventArgs> (httpChannel_ShellNotificationReceived);

httpChannel.ExceptionOccurred += new EventHandler <NotificationChannelExceptionEventArgs> (httpChannel_ExceptionOccurred);}

Page 10: Name Title Microsoft Corporation

Using PN from your Windows Phone application – Part #2 Subscribe to notifications

private void SubscribeToNotifications(){ //Subscribe to a toast notification httpChannel.BindToShellNotification();

ShellEntryPoint shellEntryPoint = new ShellEntryPoint(); shellEntryPoint.RemoteImageUri = new Uri("http://developer.windowsphone.com/Common/Fire/Images/bg-brand.png", UriKind.Absolute);

//Subscribe to a tile notification httpChannel.BindToShellEntryPoint(shellEntryPoint);}

Page 11: Name Title Microsoft Corporation

11 Microsoft Confidential

Live content from the cloud

Tile extensions

Only applies to background images of tiles

Atomic operation performed when download completed

Page 12: Name Title Microsoft Corporation

Sending Notifications – Server Side

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(channelUri);request.Method = WebRequestMethods.Http.Post;

request.ContentType = "text/xml; charset=utf-8";request.ContentLength = payload.Length;

request.Headers[MESSAGE_ID_HEADER] = Guid.NewGuid().ToString();

//"token“ or “toast”request.Headers[NOTIFICATION_CLASS_HEADER] =

((int)notificationType).ToString();

if (notificationType == NotificationType.Toast) request.Headers[WINDOWSPHONE_TARGET_HEADER] = "toast";else if (notificationType == NotificationType.Token) request.Headers[WINDOWSPHONE_TARGET_HEADER] = "token";

Page 13: Name Title Microsoft Corporation

Sending Tile Notification – Server Side

• Need to POST

<?xml version="1.0" encoding="utf-8"?><wp:Notification xmlns:wp="WPNotification"> <wp:Token> <wp:Img><background image path></wp:Img> <wp:Count><count></wp:Count> <wp:Title><title></wp:Title> </wp:Token></wp:Notification>

Page 14: Name Title Microsoft Corporation

Sending Toast Notification – Server Side

MemoryStream stream = new MemoryStream();

byte[] prefix = Encoding.UTF8.GetBytes("X-WindowsPhone-Target: TOAST\r\n\r\n"); stream.Write(prefix, 0, prefix.Length);

XmlWriterSettings settings = new XmlWriterSettings() { Indent = true, Encoding = Encoding.UTF8 }; XmlWriter writer = XmlWriter.Create(stream, settings); writer.WriteStartDocument(); writer.WriteStartElement("wp", "Notification", "WPNotification"); writer.WriteStartElement("wp", "Toast", "WPNotification"); writer.WriteStartElement("wp", "Text1", "WPNotification"); writer.WriteValue(text1); writer.WriteEndElement(); writer.WriteStartElement("wp", "Text2", "WPNotification"); writer.WriteValue(text2); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndDocument(); writer.Close();

byte[] payload = stream.ToArray(); return payload;

Page 15: Name Title Microsoft Corporation

Sending Tile Notification – Server Side

• Need to POST

<?xml version="1.0" encoding="utf-8"?><wp:Notification xmlns:wp="WPNotification"> <wp:Token> <wp:Img><background image path></wp:Img> <wp:Count><count></wp:Count> <wp:Title><title></wp:Title> </wp:Token></wp:Notification>

Page 16: Name Title Microsoft Corporation

Sending Tile Notification – Server Side

MemoryStream stream = new MemoryStream();byte[] prefix = Encoding.UTF8.GetBytes("X-WindowsPhone-Target: TOKEN\r\n\r\n"); stream.Write(prefix, 0, prefix.Length);

XmlWriterSettings settings = new XmlWriterSettings() { Indent = true, Encoding = Encoding.UTF8 }; XmlWriter writer = XmlWriter.Create(stream, settings); writer.WriteStartDocument(); writer.WriteStartElement("wp", "Notification", "WPNotification"); writer.WriteStartElement("wp", "Token", "WPNotification"); writer.WriteStartElement("wp", "Img", "WPNotification"); writer.WriteValue(backgroundImageUri); writer.WriteEndElement(); writer.WriteStartElement("wp", "Count", "WPNotification"); writer.WriteValue(count.ToString()); writer.WriteEndElement(); writer.WriteStartElement("wp", "Title", "WPNotification"); writer.WriteValue(title); writer.WriteEndElement(); writer.WriteEndElement(); writer.Close();

byte[] payload = stream.ToArray(); return payload;

Page 17: Name Title Microsoft Corporation

17 Microsoft confidential.

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:ConnectedSubscriptionStatus- The subscription status- //For example: X-SubscriptionStatus:ActiveMore information - http://msdn.microsoft.com/en-us/library/ff402545(v=VS.92).aspx

Response Custom Headers

Page 18: Name Title Microsoft Corporation

19 Microsoft Confidential

Summary

• Efficient battery utilization• Minimize memory footprint• Reduce processor cycles

• Unified heartbeat reduces number of connections

• Device is always “visible” from the cloud

• Simple programming model on the phone• Simple to integrate existing Web 2.0

solutions• Quick ramp up for developers who currently

lacks services

Page 19: Name Title Microsoft Corporation

20 Microsoft Confidential

Web 2.0 services which use the Web hooks pattern

Download the tools! Works on the Emulator!http://developer.windowsphone.com

Microsoft hosted push service is in production.

What’s next?

Page 20: Name Title Microsoft Corporation

QUESTIONS?

Page 21: Name Title Microsoft Corporation

© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

The information herein is for informational purposes only and 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. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

The information herein is for informational purposes only and 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. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.


Recommended