building connected android apps with azure chris risner technical evangelist microsoft...

33
Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft [email protected] @chrisrisner

Upload: martha-york

Post on 30-Dec-2015

219 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

Building Connected Android Apps with AzureChris RisnerTechnical EvangelistMicrosoft

[email protected]@chrisrisner

Page 2: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

IntroductionJust a little bit about me

@chrisrisner

From Washington

iOS / Android developer for 4 years

Windows Azure Technical Evangelist

Chrisrisner.com

Grew up in Michigan

2nd time at DevNexus

Page 3: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

Agenda

Mobile Services

Advanced Features

Features and Demos

Scaling

Questions

Page 4: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

What is Mobile Services?

Data

Notifications

Auth

Server Logic

Scheduler

Logging & Diag

Scale

Page 5: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

demo

Getting Started

Page 6: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

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 7: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

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 8: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

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 9: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

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

.NET backend Available (preview)

Page 10: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

Node ModulesExtensibility through numerous included modules

request

console

push.*

mssql

statusCodes azure

sendgrid

pusher

twilio

Page 11: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

demo

Adding Server Scripts

Page 12: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

Push Notifications1. Register for push

notifications with GCM

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 13: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

demo

Push Notifications

Page 14: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

Notification Hubs (enhanced push)Highly scalable push notifications!

Cross-Platform

Template based registrations

Tag based registrations

Scalable

.NET SDK, Node SDK, REST API, Java SDK (unofficial)

Page 15: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

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)• 401 / Unauthorized response if a call doesn’t

pass

Page 16: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

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 17: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

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 18: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

The User object• User.level

• Admin• Authenticated• Anonymous

• User.userId• Provider:id or undefined

• User.getIdentities()• UserId• Provider Access Token / Secret• Name, locale, picture, etc

Page 19: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

demo

Adding Authentication

Page 20: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

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 21: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

demo

Using the CLI

Page 22: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

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 23: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

Custom API• Non-table based scripts• Accessible from

• Get• Post• Put• Patch• Delete

• Same permissions as tables

Page 24: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

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 25: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

demo

Scheduler, Script Source Control, Custom API, NPM

Page 26: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

Diagnostics, Logging, Scale

API Calls, Devices, Data Out

Console logging from Scripts

Scale service based off of API Calls

Scale SQL DB / Server

Page 27: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

Service ScaleFree

500K API calls per subscription per month

Basic1.5M API calls per unit per month

Standard15M API calls per unit per month

Page 28: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

demo

Diagnostics, Logging, Scale

Page 29: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

Mobile Services Tiersusage & licensing $ service level

agreements

General Availability99.9%

Free Basic Standard

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 (reset daily).

Page 30: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

Windows Azure Mobile Services

Data

Notifications

Auth

Server Logic

Scheduler

Logging & Diag

Scale

Page 31: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

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]

@chrisrisner

Page 32: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

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

Page 33: Building Connected Android Apps with Azure Chris Risner Technical Evangelist Microsoft chrisner@microsoft.com @chrisrisner

OAuth Authentication Flow