building connected io s apps

of 27 /27
Building Connected iOS Apps Chris Risner Technical Evangelist Microsoft @chrisrisner

Author: paxton

Post on 11-Feb-2016




0 download

Embed Size (px)

DESCRIPTION @ chrisrisner. Building Connected iO S Apps. Chris Risner Technical Evangelist Microsoft. How we got here Mobile Services Features and demos Win a prize Questions. What we’re going to talk about. How did we get here?. What we had. Storage. Identity. - PowerPoint PPT Presentation


Building Connected Windows 8 Apps with Windows Azure Mobile Services

Building Connected iOS AppsChris RisnerTechnical EvangelistMicrosofthttp://[email protected]

1How we got hereMobile ServicesFeatures and demosWin a prizeQuestionsWhat were going to talk aboutHow did we get here?

We started by talking with iOS, Android, and Windows Phone developers and asked them what would make it easier to use Windows Azure as their backend.3What we had

Cloud services


IdentityWhen we went and spoke with Mobile Developers we had the following offerings

StorageCloud ServicesIdentity (with ACS)4What we neededCross Platform


We neededCross platform support (web and phone)Data storageAuthenticationPush notifications5What we made

What is Windows Azure Mobile Services?DataNotificationsAuthServer LogicScheduler

Logging & DiagScaleSlide Objectives:Provide broad overview of WA Mobile Services features

Speaking Points:

WAMSBuild a cloud backend in minutes with no hassles, no deployments, no fearSupports Windows 8 client SDK, Windows Phone 8 SDK, iOS SDK Android coming soon

DataStructured Storage with SQL DatabaseAutomatic service api generated for storageRich querying capability

Server LogicAutomatic CRUD service api generatedAbility to author server logic that intercepts CRUD operation pipeline

AuthAuthenticate against Facebook, Google, Microsoft Account (Live), and TwitterTable level authorization with no code More granular control with server side scripts

NotificationsIntegrates with WNS and APNS to provide Toast, Tile, Badge and Raw notificationsClean object model to compose notifications

SchedulerScheduler allows you to run Scripts to perform tasks at a scheduled basis minutes, hrly, daily, monthly or on demand.Example aggregate News RSS feeds and send a tile update every 15 minutes

Logging and Diagnostics for monitoringScale out and Scale up

2012 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.3/21/137Getting Started a backend for your mobile app in minutesDemoDemo the New Mobile Service Create a new iOS application experience in the portal8Structured StorageStructured Storage with SQL DatabaseSame DB multiple Mobile ServicesAppX.TodoitemAppY.TodoitemManage data inPortal, SQL PortalSQL Management StudioREST APICLI Tools

Slide Objectives:Detail the structured storage feature

Speaking Points:Structured storage provided by WAMS is backed by a Windows Azure SQL DatabaseDB can be Multi-tenant i.e 10 Mobile services can all use the one SQL Database. In this scenario each DB is partitioned by SchemaMultiple ways admins can access the raw data being stored.

9REST API to SQL type mappingsJSON ValueT-SQL TypeNumeric values (integer, decimal, floating point)FloatBoolean BitDateTimeDateTimeOffset(3)String Nvarchar(max)Slide Objectives:Detail the current REST API JSON value to T-SQL type mappings

Speaking Points:Table shows the current JSON type mapping to T-SQL mapping used when columns are dynamically generated.As we iterate on mobile services you will see the list of type mappings grow

10Server LogicAutomatic REST API generated for storageDynamic Schema on/offAbility to customize server logic that intercepts table requests

Slide Objectives:Detail the Server Logic capability

Speaking Points:On creating of a Mobile Service a dynamic REST API is generated that sits on top of your structured storageDynamic SchemaWhen Dynamic Schema is enabled, your Mobile Service will automatically add columns to tables as necessary to store incoming data.When Dynamic Schema is disabled, your Mobile Service will only accept data whose properties correspond to existing columns on your tables.

11Server LogicSupported Modules + Globalsrequestconsolepush.*tablesmssqlstatusCodesazurestore (pusher, sendgrid, twilio, etc)

mssql.query('select top 1 * from statusupdates', { success: function(results) { console.log(results); } }); Slide Objectives:Detail the Modules and Globals available to server side scripts.

Speaking Points:Talk through the slidePush.* currently supports push notifications for W8 (push.wns), WP8 (push.mpns), iOS (push.apns), Android coming soonA subset of Node.js modules are also supportedPerforming SQL queries is something that some people are not aware of. Instead of tables if you want to use mssql you can execute sql directly. One useful example of this would be to execute a stored procedure

Latest full list here:

12Server Logicadding server logic on CRUD operationsDemoSlide Objectives:Builds on the getting started application to Demonstrate how to add some simple server logic to an operation like the Insert operation. See example in video here

13Push Notification Lifecycle OverviewRegister for push notificationsRegister with your send token to Mobile ServicePush from server side scriptsiOSAppMobile ServicesApple Push Notification Service(1)(2)(3)(3)Slide Objectives:Detail the push notification lifecycle to give context for the demo coming upAPNS is free

Speaking Points:Show the start screen and talk about how push notifications can be used to lightup the start screenGreen components are those FREE services Apple providesBlue components are those components that the application developer must write.Step 1 using the iOS API, request a token. A token uniquely identifies an app and device.Step 2 token is then registered and stored in your Mobile serviceStep 3 When your application specific logic determines that it is time to send a notification you can retrieve the token and compose a notification to be sent. Mobile Services makes this step incredibly easy.Step 3 - part 2 APNS will take care of delivering the notification and the client and deal with delivering it to the app or presenting it onscreen

14Push NotificationsDemoSlide Objectives: Continue building out the Getting Started sample by adding Push Notifications to toast

Notes:Full demo script and snippets available in the links on slide 2.15User Auth

Slide Objectives:Detail Auth options

Speaking Points:Support for several auth providers

16Auth Data and ScriptsTable level permissions for each CRUD operationEveryoneAnyone with the Application KeyOnly Authenticated UsersOnly Scripts and AdminsMore granular control with server side scriptsuser.level: {admin, authenticated, anonymous}user.userId: id or undefined if not authenticated

Windows Azure Mobile Services enables you to set the following permissions on table operations: Everyone: This means that any request for the operation against the table is accepted. This option leaves your data wide-open for everyone to access. Anybody with the Application Key: Only the correct application key is required to perform the operation. The application key is distributed with the application. Because this key is not securely distributed, it cannot be considered a security token. To secure access to you mobile service data, you must implement authentication. Only Authenticated Users: Only authenticated users are permitted to perform the operation. In this preview release, clients are authenticated by Live Connect services. Scripts can be used to further restrict access to tables based on an authenticated user. Only Scripts and Admins: The operation requires the service master key, which limits the operation only to registered scripts or to administrator accounts.

The user parameter is available in all server side scripts methods and can be used to add more granular auth polices on you CRUD operations


17Adding Authenticationintegrating with TwitterDemoSlide Objectives:Continue building out the Getting started application by adding auth.

Notes: Demo script with full code snippets available in link on slide 2

18Command Line ToolsCreate servicesDelete servicesCreate (with auth options), update, delete, list tablesUpload, delete, download, list scriptsGet configuration

Command line tools allow:Creating and deleting servicesTable accessScript accessConfiguration info19Using the CLI DemoDemo CLI tools20SchedulerExecute scripts on a Scheduleby Minutesby Hoursby DaysBy MonthsExecute scripts on DemandExamples Periodic purge of old data Poll and aggregate from 3rd party (Twitter, RSS, others) Process/resize images Schedule sending push notifications for a given time of day

Scheduler-on a schedule-on demand21Scheduling a taskAdding Todo ItemsDemoSlide Objectives:Continue building out the Getting started Mobile Service adding a Schedule

Notes: Demo script with full code snippets available in link on slide 2

22Diagnostics, Logging and ScaleDiagnosticsAPI callsCPU TimeData Out


Scale - ComputeScale out instance countScale up VM size

Scale - StorageScale out mobile service tenant to dedicated SQL DBScale up SQL DB

Slide Objectives:Detail what Mobile Services provides as far as Diagnostics, Logging and Scale is concerned

Speaking Points: Note when moving a Mobile Service from a multi-tenant DB to its own. Currently data is not automatically migrated.

23Diagnostics, Logging, Scale

DemoSlide Objectives:Show diagnostics graphs provided by portalShow logging that has been performed by the sever side script snippetsShow scale out functionality. i.e move increase shared instances, then move to reserved mode.

Speaking Points: when scaling out note speed with which your service is scaled out across multiple instances and/or from shared to reserved

24Pricing Example:

10 x Mobile Services on shared instances100MB SQLDatabaseUnlimited data in