Building Windows Phone Apps with Mobile Services Speaker Name Speaker Title Speaker Company Email:...

Preview:

DESCRIPTION

What is Mobile Services?

Citation preview

Building Windows Phone Apps with Mobile ServicesSpeaker NameSpeaker TitleSpeaker Company

Email:Twitter:

AgendaMobile Services

Push Notifications

Data Storage

Security and Authentication

Other Features and Scaling

Questions

What is Mobile Services?

Data

Notifications

Auth

Server Scripts

Scheduler

Logging & Diag

Scale

demoGetting Started

Structured StoragePowered by SQL DatabaseSame DB – Multiple Mobile Services

AppX.TodoitemAppY.Todoitem

Data management inWindows Azure PortalSQL Portal, SQL Management StudioREST APICLI Tools

The REST API

Action HTTP Verb URL SuffixCreate POST /TodoItemRead GET /TodoItem?$filter=id%3D42Update PATCH /TodoItem/idDelete DELETE /TodoItem/id

Data Operations and their REST Equivalents

Base REST API Endpoint URLhttps://Mobileservice.azure-mobile.net/tables/*

JSON to SQL Type MappingsJSON Value T-SQL TypeNumeric values (integer, decimal, floating point)

Float(53)

Boolean BitDateTime DateTimeOffset(3)String Nvarchar(max)

Server Side ScriptsCustomizing logic on the server

Node.js scripts

Passes through to SQL by default

Intercept CRUD requests to tables

Fully customizable logic flow

Node ModulesExtensibility through numerous included modules

request

console

push.*

mssql

statusCodes azure

sendgrid

pusher

twilio

demoAdding Server Scripts

Push Notification Lifecycle Overview 1. Request Channel URI

2. Register with your Cloud Service

3. Push Notification

Windows Phone

(1)

(2)

(3)

(3)

(1)

Push NotificationsSupport push for WNS, MPNS, APNS. For WP:Integrates with MPNS to provide Toast, Tile and Raw notificationspush.mpns.* provides:

clean easy object model to compose notificationspush.mpns.[sendFlipTile(..) | sendTile(..) | sendToast(..) |

sendRaw(..)]

demoPush Notifications

Auth*Authenticate against Microsoft Account, Twitter, Facebook, GoogleTable level permissions for each CRUD operation

EveryoneAnyone with the Application KeyOnly Authenticated UsersOnly Scripts and Admins

More granular control with server side scriptsuser.level: {admin, authenticated, anonymous}user.userId: id or undefined if not authenticated

The User objectUser.level

AnonymousAuthenticatedAdmin

User.userIdProvider:id or undefined

User.getIdentities()UserIdProvider Access Token / Secret

demoAdding Authentication

Custom APINon-table based scriptsAccessible from

GetPostPutPatchDelete

Same permissions as tables

Using the SchedulerExecute scripts on a scheduleExecute scripts on demandFrequency and length of execution based

off of service levelIdeal for backend data processing

Script Source ControlHandled through GIT repo• Access to table, scheduler, custom API, shared

scripts, and permissionsShared Scripts• Make scripts accessible from other scripts• Just like creating Node.js modulesNPM• Ability to use ‘npm install module’ to download

NPM modules

demo

Scheduler, Script Source Control, Custom API, NPM

Command Line ToolsScriptable control from PowerShell / Bash

Create / Delete Services

Create / Update / Delete Tables and Permissions

Inspect / Delete Table Data

Create, / Upload / Delete Scripts

Scale Up / Down Services Much More!

demoUsing the CLI

Diagnostics, Logging, Scale

API Calls, Devices, Data Out

Console logging from Scripts

Scale service based off of API Calls

Scale SQL DB / Server

Service ScaleFree

500K API calls per subscription per month

Standard1.5M API calls per unit per month

Premium15M API calls per unit per month

demo

Diagnostics, Logging, Scale

Mobile Services Tiersusage & licensing $ service level

agreementsGeneral Availability99.9%

Free Standard Premium

Usage Restrictions

Up to 10 services,Up to 500 Active

Devices*

N/A N/A

API Calls 500K (per subscription)

1.5M(per unit)

15M(per unit)

Scale N/A Up to 6 Standard units

Up to 10 Enterprise units

Scheduled Jobs

Limited Included Included

SQL Database (required)

20MB Included, Standard rates apply for more capacity

20MB Included, Standard rates apply

for more capacity

20MB Included, Standard rates apply for more capacity

*Active devices refers to the number of physical devices and emulators that make at least one call to or receive a push notification from your mobile service.

Windows Azure Mobile Services

Data

Notifications

Auth

Server Scripts

Scheduler

Logging & Diag

Scale

ResourcesGet a Windows Azure Free Trial Accounthttp://www.windowsazure.com

Videos, Tutorials, and Morehttp://www.windowsazure.com/mobile

Source code on GitHubhttps://github.com/WindowsAzure/azure-mobile-services

Contact Detailsmobileservices@microsoft.comFeature Requests

© 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista 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.

API AuthorizationREST

API

SCRIPTS

SECURITYAdmin

App Key

Everyone

APP Key?

MasterKey?

*Passes App Key / Auth user rescritions

*should only be used during dev

403 on deny

Authenticated Users

APP

REST

API

SCRIPTS

SECURITY

Valid User ID

+ Token

User ID +Auth Token

Provider

Token

OAuth Authentication Flow

Recommended