Cross Platform Push with Azure Jason Farrell Centare – Chicago, IL @jfarrell http://www.jfarrell.net
Who Am I? Staff Consultant for Centare Chicago Consultant for 6yrs (Chicago, Michigan, NYC) Variety of verticals Specializing in web, client, and mobile Hockey and Travel enthusiast
1 2 3 1 2 3 Who is Centare? Modern / Agile Transformation Teams Executives Organizations Modern / Agile Transformation Assessment 1 Training 2 Coaching 3 Milwaukee Chicago Madison Deep Platform Leadership Modern / Agile Software Delivery Agile Techniques ALM Cloud 1 Teams Scale Flexibility 2 Turnkey Off Site On Site 3 #1 Scrum.org partner in the world 2011 Microsoft ALM Partner of the Year Finalist Transformation and Delivery SCRUM be applied to any area, not just technical Delivery done using SCRUM with sprints or on site delivery experts Reduce cost and risk
Lets talk about why First modern smartphone – Apple iPhone Clearly defined as a telephony + data device Relied on the user to pull their data Later added Notification Center to support APNS Android Widgets Feed data from services directly to the user At a glance decision making First real concept of an app experience Windows Live tiles Push is a central component of the OS Live tiles serve as the desktop & Notification Center Data is part of the entire phone experience Lack of a dedicated Notification Center is a weakness of the OS App vs Experience Push allows the experience of your app to extend beyond when its running
Push Notification by Platform
Apple Push Notification Service (APNS) Launch in 2009 Device Token is for security, to identify the device Payload size may NOT exceed 256 bytes Shared with OSX (>= Lion) Requires certification of the app via a provisioning profile Provisioning profile is associated with the app in XCode
Google Cloud Messaging Service Polling Service polls a remote service in the background (Twitter) Google Cloud Messaging Successor to Google Cloud to Device Messaging (C2DM) 4KB payload limit ID Based Relies on a built in receiver (GCMBroadcastReceiver) and the custom defined GCMIntentService Class name appears to be required (GCMIntentService)
Microsoft Push Notification Service (MPNS) Raw allows 1KB for payload size Windows Notification Service (WNS) Requires a token 5kb payload size Full featured Send Raw, Tile, and Toast WNS requires client secret and Package Identifier (obtained from Windows store) Sent over HTTPS (MPNS uses HTTP) Separate services, for now.
The Tiles Windows Phone 8 offers three templates: Iconic Cycle Flip Mention background override technique Over 50 tile templates in Windows 8 (resources for link)
Push Notification Registration How it works Push Notification Registration Pretty much the same for all platforms, though nomanclature differs - Apple: Device Token - Google: Registration Id - Windows: Channel Url Device contacts the notifications service (MPNS, GCM, APNS, WNS) Notification Service returns an identifier for the device When it comes time to send a push, use this identifier to send the notification Identifier received from Notification Service Send a request for a Push identifier
How it works Push Service An external service is operating in the cloud or it could even be a website Tells the provider to send a push notification to a client (remember the identifier) The provider and the service can be one in the same or they can be different The service receives the request and sends to the specific device Many scenarios are enabled in this model (ex. Codemash Polling)
A variety of third party providers exist A variety of ways to communicate with connected devices in real time Also offer ways to store device data in the cloud Parse supports Push for iOS and Android Urban Airship supports iOS, Android, Blackverry, and Windows Phone/Windows Azure Mobile Services supports Windows, Android and iOS Push Pusher is Push for your HTML5 apps
Mobile Services Mobile Services is one of the many offerings from the Azure platform Easiest means I have found to universally support all platforms
A bit about Azure Mobile Services Cloud based storage Backed by SQL Azure Integrated with node.js for Push Notifications Supports authentication against Twitter, Facebook, Microsoft, and Google No REST API for notifications SQL Azure is accessible from SQL Server Management Studio Dynamic Table Creation All tables must have an Id column Table must be created before it can be used Schema will change if the object signature changes and dynamic schema is enabled Can be turned off No joining – views are possible, but not recommended (SSMS) Application Key does NOT guarantee security To maintain security at the user level for tables, use authentication (FB, Twitter, etc) Master Key for admin operations
node.js Integration Full featured API for all push services Can send badges for iOS, sound file, and additional data if desired GCM sends a JSON object to the Android device, pull extras (demo) MPNS has methods for each of the supported notification methods WNS has a method for every support notification as well (over 50 ways) MPNS method names sendFlipTile sendTile sendToast sendRaw Custom node.js modules are not allowed Events Util Crypto String_decoder Path Dns Punycode Readline Assert Zlib azure Full support for logging as a means to debug
Pricing Free and Reserved Reserved is $0.10/hr per instance Free is shared, Reserved is dedicated Free 165MB outbound data per day 5GB free on standard rates Pay for the database – most subscriptions grant free DB space ~$5/mn for a since DB between 0 and 100MB http://bit.ly/MobileCalc Outbound data 5GB equates 21 million pushes to APNS (at max size) 1.3 million pushes to GCM (at max size) 5.2 million raw notifications to MPNS (at max size) 1 million notifications to WNS (at max size)
Cross Platform Push Demonstration SignalR, MVC4, Web API, Objective-C, Java, C#, XAML, JavaScript Register all devices Update Azure with the values How are the values obtained Windows 8 Google Apple Add the Script Push to devices
How the Demo works Azure Mobile Services Web App Registration API Client Devices
Closing Thoughts The way we used a smartphone changed with the advent of the iPhone It has further evolved since The way we gather data has changed as well Expecting the user to Pull their own data is not acceptable Proliferation of social services Reliance on smartphones as data devices An app is temporary, an experience is forever Create a continuous experience with Push
Resources http://www.parse.com http://bit.ly/AzureMS http://bit.ly/windowsphonepush http://bit.ly/Win8TileList http://bit.ly/PushReference http://bit.ly/PushDemoSource - Complete Demo Source code
Questions or Comments
Thank You