Use Web APIs Building Android Applications that

Preview:

Citation preview

Building Android Applications that Use Web APIsYaniv Inbar, Senior Software Engineer, GoogleSriram Saroop, Product Manager, Google

#io12 #AndroidWebAPIs

Android and Web APIs

Web

AP

IsE

ndpo

ints

#io12 #AndroidWebAPIs

Blogger APIBooks APICalendar APIDrive APIGoogle+ APIPrediction APITasks APITranslate APIYouTube API

Google's Web APIs

Web

AP

Is#io12 #AndroidWebAPIs

Google Client Libraries for Java

HTTP (goo.gl/onpMx)

OAuth (goo.gl/dXFtZ)

Google API Libraries & Base Library(goo.gl/yV6R6)

#io12 #AndroidWebAPIs

Open Source (Apache License 2.0)

Client Library Architecture

HTTP Android App Engine JSON XML

OAuth 2.0

OAuth 1.0a

Partial JSON Batch Media JSON

Errors

Blogger Calendar Google+ Tasks Translate

HTTP

OAuth

Google Base Lib

API Libraries

#io12 #AndroidWebAPIs

Google's Web APIs References

#io12 #AndroidWebAPIs

Google APIs: Getting Startedyoutu.be/SZj6rAYkYOg

Optimizing Your Code Using Features of Google APIsgoo.gl/dNwik

OAuth 2.0

#io12 #AndroidWebAPIs

requests with access tokenstart app

Google Auth Server

allow app?access token

valid access token?

OAuth 2.0 Scopes

#io12 #AndroidWebAPIs

Calendar API

Scope Permissioncalendar Manage your calendarscalendar.readonly View your calendars

e.g. https://www.googleapis.com/auth/calendar.readonly

OAuth 2.0 Reference

#io12 #AndroidWebAPIs

OAuth 2.0 for Identity and Data Accessgoo.gl/d7jFg

Using OAuth 2.0 to Access Google APIsgoo.gl/W1hUc

“OAuth on Android is complicated”

AccountManager Woes (Froyo)

#io12 #AndroidWebAPIs

Old Way

Google Play services (Froyo)

#io12 #AndroidWebAPIs

Coming

Soon

AccountPicker in Google Play services (Froyo)

#io12 #AndroidWebAPIs

Coming

Soon

Google Play services

#io12 #AndroidWebAPIs

Coming Soon

● Froyo or later● Readable permissions● AccountPicker● Secure: application signature

○ No API key● Token Caching

○ No expired tokens

https://developers.google.com/android/google-play-services

Demo: Calendar API Sampleopen source at goo.gl/1WIY4

Google Cloud Endpoints

Google Cloud Endpoints:Backend for Mobile and Web Apps

Storage

Web APIs

End

poin

ts

Trusted Tester

#io12 #AndroidWebAPIs

ApplicationBackend

Google Cloud Endpoints:

ApplicationBackend

Google Cloud Messaging for Android

End

poin

ts

Trusted Tester

#io12 #AndroidWebAPIs

Endpoints Use Cases

#io12 #AndroidWebAPIs

Trusted Tester

● Centralize business logic, computation, and storage● Share application state across devices● Google Cloud Messaging to push notifications to devices

Sign Uphttp://endpoints-trusted-tester.appspot.com

Demo: CloudNotes Endpoints Sampleopen source at goo.gl/ZlN2E

Google Cloud Endpoints References

#io12 #AndroidWebAPIs

Building Mobile App Engine Backends for Android, iOS and the Webgoo.gl/AhPXd

HTML5 and App Engine: The Epic Tag Team Take on Modern Web Apps at Scalegoo.gl/U0zXy

Google I/O Codelabs

Building REST APIs for Mobile with App EngineFriday, 11:00AM - 1:00PM

Building Android Applications that use Web APIsFriday, 1:15PM - 3:15PM

#io12 #AndroidWebAPIs

Thank You!Yaniv Inbar, Senior Software Engineer, GoogleSriram Saroop, Product Manager, Google

#io12 #AndroidWebAPIs

Recommended