Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Using Google APIs Client for Android
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Yuren Ju
October 28, 2012
Programming
5
3.3k
Using Google APIs Client for Android
Yuren Ju
October 28, 2012
Tweet
Share
More Decks by Yuren Ju
See All by Yuren Ju
Taste Cucumber.js - JavaScript BDD Framework
yurenju
0
170
Code For America 見聞錄 - 社會安全網
yurenju
0
230
Impossible Election for recall in Taiwan
yurenju
1
490
物資管理系統與災民證
yurenju
0
1k
JavaScript 開發流程自動化懶人包
yurenju
38
6.1k
Code Coverage -- Javascript Frontend + Backend
yurenju
14
8k
Loopback + Angular.js
yurenju
3
580
bifrost 物資管理系統
yurenju
4
300
Gaia Build System introduction
yurenju
2
210
Other Decks in Programming
See All in Programming
Fluid Templating in TYPO3 14
s2b
0
130
IFSによる形状設計/デモシーンの魅力 @ 慶應大学SFC
gam0022
1
300
AI巻き込み型コードレビューのススメ
nealle
1
200
CSC307 Lecture 05
javiergs
PRO
0
500
AI時代の認知負荷との向き合い方
optfit
0
160
CSC307 Lecture 02
javiergs
PRO
1
780
それ、本当に安全? ファイルアップロードで見落としがちなセキュリティリスクと対策
penpeen
7
3.9k
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
210
Patterns of Patterns
denyspoltorak
0
1.4k
CSC307 Lecture 08
javiergs
PRO
0
670
15年続くIoTサービスのSREエンジニアが挑む分散トレーシング導入
melonps
2
200
React 19でつくる「気持ちいいUI」- 楽観的UIのすすめ
himorishige
11
7.4k
Featured
See All Featured
Producing Creativity
orderedlist
PRO
348
40k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
150
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
From π to Pie charts
rasagy
0
120
Context Engineering - Making Every Token Count
addyosmani
9
650
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
74
Being A Developer After 40
akosma
91
590k
Testing 201, or: Great Expectations
jmmastey
46
8k
HDC tutorial
michielstock
1
370
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
110
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.6k
Transcript
別再手刻 APIs Client 了 使用 Google APIs Client for Android
Yuren Ju
Yuren Ju • Open Source Community – Kalug – COSCUP
– Hacking Thursday • Open Source Developer – Lazyscripts – Ubuntu 懶人包 – Mozilla Firefox OS • Android Developer
Web service API
有很多種路可以走 ... • 手刻 – HttpGet/HttpPost • Restlet • Google
APIs Client for Java! http://www.flickr.com/photos/fractalthoughts/4903092759/in/photostream/
Implementing an API method • Build URL • Get content
(GET/POST) • Convert to object
手刻 http://www.flickr.com/photos/carnivillain/2048440745/
Building URL
Getting Content (GET)
Getting Content (POST) http://blog.csdn.net/flying_tao/article/details/6553601
Converting to object
Google APIs Client Library for Java
None
Example http://<DOMAIN-NAME>/api/emails/
[email protected]
verifyEmail(“819284”, “
[email protected]
”).execute();
Implementing an API method
Parameters Mapping http://<DOMAIN-NAME>/api/emails/
[email protected]
GET v.s. POST
POST
Preconditions
Implementing an API method
Getting started! http://code.google.com/p/google-api-java-client/wiki/Setup
Example service
.jar files
No!!!!!!!
None
Create API Client
Use Builder pattern
HttpRequestInitializer
Create Model
Implement the API
比較 • Get content (GET/POST) • Convert to object •
Preconditions • Parameter mapping/Build URL
OAuth https://github.com/yurenju/AndroidTwitterGoogleApiJavaClient
Attention! Use xAuth on mobile! OAuth experience with pin code
isn't good on mobile https://dev.twitter.com/docs/oauth/xauth
Android app Twitter OAuthGetTemporaryToken OAuthAuthorizeTemporaryTokenUrl Listen OnLoadPageFinished and parse pin
code in webpage Enter username and password Show pin code Done!
OAuthGetTemporaryToken
OAuthAuthorizeTemporaryTokenUrl
None
Parse pin code in webview Don't do it on your
production app, please use xAuth
Conclusion • Build URL • Handle POST/GET Method • Preconditions
• Android, GAE and Java SE Compatibility
FAQ