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
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
240
Impossible Election for recall in Taiwan
yurenju
1
500
物資管理系統與災民證
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
Rails Girls Tokyo 18th GMO Pepabo Sponsor Talk
yutokyokutyo
0
180
AIプロダクト時代のQAエンジニアに求められること
imtnd
1
510
AIに仕事を丸投げしたら、本当に楽になれるのか
dip_tech
PRO
0
170
CSC307 Lecture 10
javiergs
PRO
1
690
CSC307 Lecture 14
javiergs
PRO
0
440
AI時代でも変わらない技術コミュニティの力~10年続く“ゆるい”つながりが生み出す価値
n_takehata
2
560
24時間止められないシステムを守る-医療ITにおけるランサムウェア対策の実際
koukimiura
2
180
株式会社 Sun terras カンパニーデック
sunterras
0
1.9k
JPUG勉強会 OSSデータベースの内部構造を理解しよう
oga5
2
220
ふん…おもしれぇ Parser。RubyKaigi 行ってやるぜ
aki_pin0
0
120
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
5
910
AIとペアプロして処理時間を97%削減した話 #pyconshizu
kashewnuts
1
170
Featured
See All Featured
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
190
Designing for Performance
lara
611
70k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Chasing Engaging Ingredients in Design
codingconduct
0
130
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
AI: The stuff that nobody shows you
jnunemaker
PRO
3
340
GraphQLの誤解/rethinking-graphql
sonatard
75
11k
How to make the Groovebox
asonas
2
2k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
110
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.5k
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