Transcript
Page 1: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

Building Android, iOS, Windows 8 Apps with Mobile Services

Pranav AinavoluThomson Reuters@a_Pranav | http://pranavon.net

Page 2: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

Agenda

Mobile Services

Push Notifications

Data Storage

Security and Authentication

Other Features and Scaling

Questions

Page 3: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

What is Mobile Services?

Data

Notifications

Auth

Server Logic

Scheduler

Logging & Diag

Scale

Page 4: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

demo

Getting Started

Page 5: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

Structured Storage• Powered by SQL Database• Same DB – Multiple Mobile Services• Data management in

• Windows Azure Portal• SQL Portal• SQL Management Studio• REST API• CLI Tools

Page 6: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

The REST API

Action HTTP Verb URL Suffix

Create POST /TodoItem

Read GET /TodoItem?$filter=id%3D42

Update PATCH /TodoItem/id

Delete DELETE /TodoItem/id

Data Operations and their REST Equivalents

Base REST API Endpoint URL

https://Mobileservice.azure-mobile.net/tables/*

Page 7: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

JSON to SQL Type MappingsJSON Value T-SQL Type

Numeric values (integer, decimal, floating point)

Float(53)

Boolean Bit

DateTime DateTimeOffset(3)

String Nvarchar(max)

Page 8: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

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

Page 9: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

Node ModulesExtensibility through numerous included modules

request

console

push.*

mssql

statusCodes azure

sendgrid

pusher

twilio

Page 10: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

demo

Adding Server Scripts

Page 11: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

Push Notifications1. Register for push

notifications with GCM/APNS/WPNS

2. Send your identifier to Mobile Service

3. Send push from server scripts

4. GCM delivers notification to device

Client

(1 )(2)

(3)(4)

Page 12: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

Data Authorization• Per HTTP method authorization options:

• App Key required• Shouldn’t be used in production

• Everyone• Authenticated Users• Admins and other scripts

• Requires the Master Key (from client)• 400 / Unauthorized response if a call doesn’t

pass

Page 13: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

User Auth Flow (server)GOOGLE

FACEBOOK

TWITTER

MOBILE SERVICE

DEVICE

CREDENTIALS

(via

oAuth/WebView)

MICROSOFT

IDEN

TITY

AUTH

TO

KEN

GRA

PH A

CCES

S (L

IMIT

ED)

Page 14: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

User Auth Flow (client)GOOGLE

FACEBOOK

TWITTER

MOBILE SERVICE

DEVICE

MICROSOFT

AUTH CODE

AUTH CODE + TOKEN

GRAPH

ACCES

S

CREDENTIALS

(via native SDKs)

IDENTITY

GRAPH ACCESS

Page 15: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

The User object• User.level

• Admin• Authenticated• Anonymous

• User.userId• Provider:id or undefined

• User.getIdentities()• UserId• Provider Access Token / Secret

Page 16: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

demo

Adding Authentication

Page 17: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

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!

Page 18: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

Using the Scheduler• Execute scripts on a schedule• Execute scripts on demand• Frequency and length of execution based

off of service level• Ideal for backend data processing

Page 19: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

Custom API• Non-table based scripts• Accessible from

• Get• Post• Put• Patch• Delete

• Same permissions as tables

Page 20: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

Script Source Control• Handled 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

Page 21: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

Diagnostics, Logging, Scale

API Calls, Devices, Data Out

Console logging from Scripts

Scale service based off of API Calls

Scale SQL DB / Server

Page 22: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

Service ScaleFree

500K API calls per subscription per month

Standard1.5M API calls per unit per month

Premium15M API calls per unit per month

Page 23: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

demo

Diagnostics, Logging, Scale

Page 24: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

Mobile Services Tiersusage & licensing $ service level

agreements

General 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.

Page 25: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

Windows Azure Mobile Services

Data

Notifications

Auth

Server Logic

Scheduler

Logging & Diag

Scale

Page 26: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

ResourcesGet a Windows Azure Free Trial Account

http://www.windowsazure.com

Videos, Tutorials, and More

http://www.windowsazure.com/Android

Source code on GitHub

https://github.com/WindowsAzure/azure-mobile-services

Contact Details

[email protected]

Feature Requests

Page 27: Building Android, iOS and Windows 8 Apps with Windows Azure Mobile Services

Namaste!


Recommended