1 / 43

Building Cloud-Connected iOS, Android and Windows Apps

Building Cloud-Connected iOS, Android and Windows Apps. Kirill Gavrylyuk | Principal Program Manager Lead, Azure Mobile Miranda Luna | Product Manager, Azure Mobile. Course Topics. Please leave this area blank to allow for picture in picture recording. Setting Expectations. Target Audience

Download Presentation

Building Cloud-Connected iOS, Android and Windows Apps

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Building Cloud-Connected iOS, Android and Windows Apps Kirill Gavrylyuk | Principal Program Manager Lead, Azure Mobile Miranda Luna | Product Manager, Azure Mobile

  2. Course Topics

  3. Please leave this area blank to allow for picture in picture recording Setting Expectations • Target Audience • Developers building iOS, Android and Windows apps, whether natively or with a cross-platform framework • Suggested Prerequisites/Supporting Material • MVA Consumer Mobile Apps that Scale • Channel9 Azure Mobile Services Learning Series • aka.ms/CommonWAMS

  4. Join the MVA Community! • Microsoft Virtual Academy—Free online training! • Ask questions in the Born to Learn MVA Forum! • Visit http://aka.ms/MVAForum • Earn while you learn! • 50 MVA Points for this event! • Visit http://aka.ms/MVA-Voucher • Code: BldgBlks3

  5. 01 | Overview

  6. Push Notifications Mobile push notification engine for existing apps Enhance push notifications in any app with personalization and localization Improves user engagement and retention by delivering relevant content more quickly Mobile Backend Ready-made mobile app backend for iOS, Android and Windows Create new mobile apps or add a mobility layer to existing systems Speeds up development time and reduces ongoing maintenance cost Device Messaging Messaging infrastructure that sits between and within applications Build multi-tier and hybrid applications or smart device information exchange patterns Delivers inter- and intra-app messages faster and connects on-premises systems to the cloud

  7. Mobile Services Overview Mobile Services App Backend can be Node.js or .NET Store Data in the Cloud SDKs Windows Store iOS Android Xamarin Sencha Windows Phone iOS Android HTML 5/JS Custom Code .NET Web API Node.js Express Table Storage Blob Storage Mongo DB SQL User Authentication REST API Active Directory Facebook Twitter Microsoft Google Push Notifications Source Control WNS & MPNS Notification Hubs APNS GCM

  8. Supported Platforms Sencha Touch Native iOS Xamarin (iOS & Android in C#) Native Android Native Win8/ WinPhone HTML5/ Javascript

  9. 02 | LensRocket

  10. Please leave this area blank to allow for picture in picture recording LensRocket • A single mobile service can power multiple client apps • LensRocket sample • iOS App Store: aka.ms/LensRocketiOS • Google Play Store: aka.ms/LensRocketAndroid • iOS source code: aka.ms/LensRocketiOSsource • Android source code: aka.ms/LensRocketAndroidsource • More: chrisrisner.com • @ChrisRisner

  11. Let’s take a look at LensRocket

  12. 03 | Choosing the Right Data Store

  13. Data • Azure SQL database by default • Many other options • Alternatively, use blob storage, table storage, SQL in a VM, or Oracle in a VM through the azure module for node.js or even on-prem SQL Server through Service Bus Relay • .NET runtime provides additional flexibility • Full control over your data in all scenarios SQL Server On-Prem SQL Server in a VM Mongo DB Azure SQL db Azure Table Storage Azure Blob Storage

  14. Please leave this area blank to allow for picture in picture recording Data in LensRocket • SQL database tables for • AccountData • Friends • Messages • RocketFile • UserPreferences • Blob Storage for • Storing Rocket image files • Connect w/ SAS URL from Mobile Services then send a POST to blob storage

  15. 04 | Adding Custom Logic

  16. “Table” API Base Table API URL http://Mobileservice.azure-mobile.net/tables/* OData CRUD endpoints

  17. Custom API • Node.js Express Controllers • Full control over HTTP • GET, POST, PUT, PATCH, DELETE • Mobile Services takes care of Auth, basic Authz, push, monitoring

  18. Please leave this area blank to allow for picture in picture recording Custom APIs in LensRocket • Custom APIs for • AcceptFriendRequest • GetRocketForRecipient • Login • Register • RequestFriend • SaveUsername • SendRocketToFriends

  19. Mobile Services .NET backend • ASP.NET WebAPI based • Custom API  Regular ApiController • Table API  XXXTableController • Helpful ODATA CRUD abstractions over various data backends • Transparent data access • Built-in auth, authz, push, monitoring, etc. • Client SDKs work with Mobile Services Node and .NET backends • We run, manage, and monitor your Mobile Service

  20. 05 | Real World Dev Environment

  21. Source Control and Deployment Mobile Services (git repository) TFS or GitHub (git repository) Local git repository

  22. Automation npm install azure-cli --g azure mobile create | delete | list | show azure mobile restart azure mobile config list | get | set azure mobile table | data azure mobile script | api //use source control instead azure mobile job

  23. Unit testing Node.js: var mock = require(“zumock”); //inspired by mocha .NET: NUnit, MSTest, etc Local F5, local debugging

  24. 06 | Versioning

  25. Add version to your client calls - (void)handleRequest:(NSURLRequest *)request next:(MSFilterNextBlock)next response:(MSFilterResponseBlock)response { MSFilterResponseBlockwrappedResponse = ^(NSHTTPURLResponse *innerResponse, NSData *data, NSError *error) { response(innerResponse, data, error); }; // add additional versioning information to the querystring for versioning purposes NSString *append = [NSStringstringWithFormat:@"build=%@&version=%@", self.build, self.version]; NSURL *url = nil; NSRange range = [request.URL.absoluteStringrangeOfString:@"?"]; if (range.length > 0) { url = [NSURL URLWithString:[NSStringstringWithFormat:@"%@&%@&p=iOS", request.URL.absoluteString, append]]; } else { url = [NSURL URLWithString:[NSStringstringWithFormat:@"%@?%@&p=iOS", request.URL.absoluteString, append]]; } NSMutableURLRequest *newRequest = [request mutableCopy]; newRequest.URL = url; next(newRequest, wrappedResponse); }

  26. Add version to your client calls public static MobileServiceClientMobileService = new MobileServiceClient( "https://<your subdomain>.azure-mobile.net/", "<your app key>", new VersionHandler() ); using System; using System.Net.Http; using System.Threading.Tasks; namespace WindowsStore { public class VersionHandler : DelegatingHandler { protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, System.Threading.CancellationTokencancellationToken) { request.RequestUri = new Uri(request.RequestUri.AbsoluteUri.ToString() + "?version=v2"); return base.SendAsync(request, cancellationToken); } } }

  27. Support multiple client versions in your scripts function insert(item, user, request) { if (request.parameters.build < 2.0) { item.description = 'Not entered'; } request.execute({ success : function() { if (request.parameters.build < 2.0) { delete item.description; } request.respond(); } }); }

  28. 07 | Cross-Platform Push w/ NH

  29. Mobile Push Notifications 101 • Register device handle at app launch • Client app contacts Platform Notification Service (PNS) • App updates handle in backend client app • Send Notification • App backend sends notification to PNS • PNS pushes the notification to the app on the device Platform Notification Service • Maintain device handles • Delete expired handles when PNS rejects them App back-end

  30. Push Notification Challenges While there are significant benefits to using push notifications in a mobile app, rolling your own push infrastructure is extremely difficult in terms of implementing a system capable of: • Cross-Platform Push Notifications Each push service (APNS for iOS, GCM for Android, WNS for Windows, etc.) has different protocols (e.g., HTTP vs. TCP, xml payload vs. JSON payload) • Targeting on the server-side based on interest and location Segmenting users based on interest tags and routing only the most relevant content to each segment • Personalizing notifications on the client-side based on language, currency, device, etc. Each device displays notifications differently • High-Volume with Low Latency Limited by the capability of each VM so need to spin up scores of VMs and shard your application in order to serve a large user base • Maintaining and accurate device handle registry Adding registrations upon installation, updating tags, pruning upon rejection from push notification service (uninstall)

  31. Azure Push Notifications One-time set up Create a Notification Hub Register The client app retrieves its current handle from the PNS. Client app (or app backend) registers the handle with Notification Hub Send Notification The app back-end sends a message to the Notification Hub. Notification Hub pushes it to the PNS Android app iOS app Windows 8.x app Notification Hub App back-end WNS APNs MPNS GCM

  32. Mobile Services + Notification Hubs Mobile Services now with Notification Hubs built-in • Cross-Platform Push Notifications • Instant broadcast to segments of your audience, or individual pushes to logical users • Personalization and localization • High-Volume with Low Latency • Device handles and PNS feedback is managed for you

  33. Please leave this area blank to allow for picture in picture recording Cross-Platform Push in LensRocket • Sending Push when • New Rocket arrives • New friend request received var payload ='{ "message" : "You\'ve received a new rocket!", "collapse_key" : "NEWROCKET" }'; notificationHubService.send(newMessage.toUserId, payload, • function(error, outcome) { •                              console.log('issue sending push'); •                              console.log('error: ', error); •                              console.log('outcome: ',outcome); •                          });

  34. 08 | Azure Store

  35. Please leave this area blank to allow for picture in picture recording Azure Store • Azure Store launched at //Build (Oct 2012). Currently in preview state. • makes it easy for Azure users to find, buy, and manage third-party services which complement and extend the Azure experience. • Add third-party services just as you would add a virtual machine or website. • Purchase using the same payment instrument as your Azure subscription. • Subscription management within Azure portal. • Single sign-on to third-party portal for service specific management tasks.

  36. Mobile Store Partners aka.ms/SendGridMobile aka.ms/NewRelicMobile aka.ms/PusherMobile

  37. 09 | Before you hit publish (!)

  38. Tips for Actually Publishing to the Store • Dev/Test Instance • Switch to using prod keys and info incl APNS cert, GCM API key • Make sure the permissions are as locked down as possible/access as restricted as possible • Turn off dynamic schema • Verify parameters, checking userIDs on all methods. • Authorization needs to be done in app code • Put in perf metrics (New Relic) • Put in usage metrics (Google) • Don’t put demo in the description • Have all the right assets • Get out of free mode • Auto-Scale

  39. 10 | Resources

  40. Mobile at //build • Building Cross-Platform Line of Business Apps with Mobile Services • Friday 4/4 12:30 – 1:30 PST • Donna Malayeri, Chris Risner • @lindydonna, @ChrisRisner • Mobile Push Notifications to Any Client with Azure Notification Hubs • Wednesday 4/2 5:30 – 6:30 PST • Elio Damaggio • @ElioDamaggio • Powerful mobile apps with Mobile Services and ASP.NET Web API • Thursday 4/3 5:30 – 6:30 PST • Kirill Gavrylyuk, Yavor Georgiev • @KirillG_MSFT, @theyavor • All videos will be available on Channel9

  41. Mobile Services Resources Windows Azure Mobile Services Overview, Tutorials and Resourceshttp://www.windowsazure.com/en-us/develop/mobile/ Collection of Helpful Tutorials and Resources http://aka.ms/CommonWAMS Learn/Channel 9http://channel9.msdn.com/Series/Windows-Azure-Mobile-Services SDKs on GitHub https://github.com/WindowsAzure/azure-mobile-services/ REST API Reference http://msdn.microsoft.com/en-us/library/windowsazure/jj710108.aspx Windows Azure Pricinghttps://www.windowsazure.com/en-us/pricing/calculator/ UserVoice for Feature Requests http://feedback.windowsazure.com/forums/216254-mobile-services Microsoft Azure Certified Traininghttp://www.microsoft.com/learning/en/us/training/azure.aspx

  42. Notification Hubs Resources Windows Azure Mobile Services Overview, Tutorials and Resources Azure Documentation Center MSDN Documenation Android (tutorial) iOS (tutorial) Windows Store (tutorial) Windows Phone (tutorial) Learn/Channel 9Introduction | iOS | Windows Store | Tags and Templates REST API Reference http://msdn.microsoft.com/en-us/library/windowsazure/jj710108.aspx Windows Azure Pricinghttp://www.windowsazure.com/en-us/pricing/details/notification-hubs/ Microsoft Azure Certified Traininghttp://www.microsoft.com/learning/en/us/training/azure.aspx

More Related