Upload
abhishek-sur
View
924
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Push technology is the future. When you are using your devices, pushing messages are an important concern that you would be using. With Cloud integration and Azure Mobile services, implementing push based service is damn easy. The presentation will give you best of knowledege about Push technology in all the devices and make a Azure integration to that. You can download the full session Video here : https://msevents.microsoft.com/CUI/EventDetail.aspx?culture=en-IN&EventID=1032561531&CountryCode=IN
Citation preview
Sending Push Notifications to Windows 8 and Windows Phone 8 devices using Windows Azure
Email : [email protected] : @abhi2434Websites: http://www.abhisheksur.com
http://www.dailydotnettips.com
Community : KolkataGeeks http://www.kolkatageeks.com
Abhishek Sur
Session Contents
What is Push Technology and why it is important?
Live Tiles and Notifications
Deep dive on using Windows Push Notification Service
Introduction to Windows Azure toolkit for Windows and Windows Phone
Building Apps using Azure Mobile Services
Difference between Push and PullPull Technology
• Pull Technology states a scenario where the request is sent from the client for which a response is pulled from the server.
• Pull based communication do not require any handshake and virtually can initiate the authentication from client itself.
• Example : HTTP Requests.
Push Technology
• Push technology states a scenario where during an internet communication, the initial request is initiated by the server.
• Push Technology requires an initial handshake, to ensure the server opens up a channel for the specified client after authentication
• Example : WNS (Windows Push Notification Service)
Windows 8 Live Tiles with Push Notifications
Types of Tiles
Tile Notification
Updates Live Tiles with animated content which stays for a long time before the next update.
Badge Notification
Updates the Live tile with a number, indicating number of Badges received
Toast Notification
Gives a Toast notification is a flying alert that stays for 30 seconds after it is invoked.
Windows Push Notification Service (WNS)
Push Notification Overview
1. Request Channel URI
2. Register with your Cloud Service
3. Authenticate & Push Notification
Windows 8
(1)
(2)
(3)
(3)
1. Request a Channel URI
Each tile has a unique Channel URI
Requested by App on each run. URI can change
Generated by WNS
Opaque to the app
Windows 8
(1)
(2)
(3)
(3)
Create WNS Notification Server
1. Upload the Application to the Windows App Store.
http://go.microsoft.com/fwlink/p/?linkid=234306
2. Reserve the App Name.
3. Add Push notification Live Services for the app
4. Change the Identity for the App from Appmanifest.
5. Get the package Security identifier and Client Secret
Walkthrough (http://msdn.microsoft.com/en-us/library/windows/apps/hh465407.aspx)
2. Register with Your Cloud Service
Register your app with your own Cloud ServiceShould be authenticated and secure
Store Channel URI and associate it with any app specific context
Create your business logic for sending notifications
Windows 8
(1)
(2)
Create WNS Notification Client
1. Create a Channel URI for the particular APP for handshaking.
2. Send the URI to the server for Unique identification of the Client.
3. Server keeps track to all the URI sent from the Client
4. Server requests the Live services with the unique URI to Push data to the client
channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
3. Authenticate & Send Notification
OAuth 2 Authentication
HTTP POST to Channel URI
XML notification payload
Windows 8
(2)
(3)
(3)
Demo
3. Push Notification Code
using Windows.Recipes.Push.Notifications;
…
var toast = new ToastNotification(_tokenProvider);toast.ChannelUrl = "https://db3.notify.windows.com/?token=AQI8iP%2OtQE%3d";
toast.ToastType = ToastType.ToastImageAndText02;
toast.Image = "https://demosa.blob.core.windows.net/toastImg1.png";
toast.Text = new List<string> {"Miguel Saenz comment on your status", "I love that quote! How have you …"};
NotificationSendResult result = toast.Send();
Push Notification Summary
1. Request Channel URI
2. Register with your Cloud Service
3. Authenticate & Push Notification
Windows 8
(1)
(2)
(3)
(3)
What a service needs to support
How do I do that with Windows Azure?
Demo
Push Notifications
Windows Phone
Push Notification in Windows Phone
1. Request Channel URI
2. Register with your Cloud Service
3. Authenticate & Push Notification
Windows Phone
(1)
(2)
(3)
(3)
Windows Phone Toast
Title. A boldface string that displays immediately after the application icon. This is defined as the Text1 property in the XML schema.
Content. A non-boldface string that displays immediately after the Title. This is defined as the Text2 property in the XML schema.
Parameter. A parameter value that is not displayed but passed to your application if the user taps on the toast. This parameter can indicate what page the application should launch to. It can also contain name-value pairs to pass to the application. This is defined as the Param property in the XML schema
Window Phone Tile - Front
Title. A string indicating the title of the application. The Title must fit on a single line of text and should not be wider than the actual Tile. Approximately 15 characters will fit in the title before being truncated.
BackgroundImage. An image displayed on the front of the Tile. Recommend that you always have a background image on the front of the Tile.
Count (also known as Badge). An integer value from 1 to 99. If the value of Count is not set or it is set to 0, the circle image and value will not display in the Tile.
Windwos Phone Tile - Back
BackTitle. A string displayed at the bottom of the back of a Tile. The BackTitle must fit on a single line of text and should not be wider than the actual Tile. Approximately 15 characters will fit in the title before being truncated.
BackBackgroundImage. An image displayed on the back of the Tile.
BackContent. A string displayed in the body of the back of a Tile. Approximately 40 characters will fit in the Tile before being truncated.
Windows Phone Raw• Push data to your application
• If app is not currently running MPNS discards the message.
RAW notificatio
n
Create MPNS Notification Client
1. Create a Channel URI for the particular APP for handshaking.
2. Send the App URI to the server for registration
3. Server keeps track to all the URI sent from the Client
4. Server requests the Live services with the unique URI to Push data to the client
5. When Client receives the notification, it will invoke the PushChannel_ShellToastNotificationReceived for Toast Notifications
HttpNotificationChannel httpchannel = new HttpNotificationChannel(channelName);
Demo
Why Mobile Services ?
Very Easy to implement, everything is in built
Fast development
Solid Foundation as it uses SQL Database for storage
Scalability of App
Step by step source code from the portal
Supports multiple platforms like Andorid, IOS with source code.
Watch the Demo
Resources
Register your apphttp://manage.dev.live.com/build
Download the Windows Azure Toolkit for Windows 8 http://WATWindows8.codeplex.com
Download the Windows Azure Toolkit for Windows Phone http://WATwp.codeplex.com
Windows 8 Developer Documentationhttp://dev.windows.com
Connect Me for more. Email : [email protected] : @abhi2434Websites: http://www.abhisheksur.com
http://www.dailydotnettips.com
Community : KolkataGeeks
http://www.kolkatageeks.com
Have a nice day ahead !!