Building Android Apps with Mobile Services Speaker Name Speaker Title Speaker Company Email:...
-
Upload
dina-lloyd -
Category
Documents
-
view
224 -
download
0
Transcript of Building Android Apps with Mobile Services Speaker Name Speaker Title Speaker Company Email:...
Building Android Apps with Mobile ServicesSpeaker NameSpeaker TitleSpeaker Company
Email:Twitter:
Agenda
Mobile Services
Push Notifications
Data Storage
Security and Authentication
Other Features and Scaling
Questions
What is Mobile Services?
Data
Notifications
Auth
Server Logic
Scheduler
Logging & Diag
Scale
demo
Getting Started
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
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/*
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)
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
demo
Adding Server Scripts
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)
demo
Push Notifications
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
User Auth Flow (server)GOOGLE
MOBILE SERVICE
DEVICE
CREDENTIALS
(via
oAuth/WebView)
MICROSOFT
IDEN
TITY
AUTH
TO
KEN
GRA
PH A
CCES
S (L
IMIT
ED)
User Auth Flow (client)GOOGLE
MOBILE SERVICE
DEVICE
MICROSOFT
AUTH CODE
AUTH CODE + TOKEN
GRAPH
ACCES
S
CREDENTIALS
(via native SDKs)
IDENTITY
GRAPH ACCESS
The User object• User.level
• Admin• Authenticated• Anonymous
• User.userId• Provider:id or undefined
• User.getIdentities()• UserId• Provider Access Token / Secret
demo
Adding Authentication
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!
demo
Using the CLI
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
Custom API• Non-table based scripts• Accessible from
• Get• Post• Put• Patch• Delete
• Same permissions as tables
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
demo
Scheduler, Script Source Control, Custom API, NPM
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
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.
Windows Azure Mobile Services
Data
Notifications
Auth
Server Logic
Scheduler
Logging & Diag
Scale
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
Feature 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.
OAuth Authentication Flow