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
120
Code For America 見聞錄 - 社會安全網
yurenju
0
190
Impossible Election for recall in Taiwan
yurenju
1
450
物資管理系統與災民證
yurenju
0
950
JavaScript 開發流程自動化懶人包
yurenju
38
6k
Code Coverage -- Javascript Frontend + Backend
yurenju
14
8k
Loopback + Angular.js
yurenju
3
550
bifrost 物資管理系統
yurenju
4
290
Gaia Build System introduction
yurenju
2
190
Other Decks in Programming
See All in Programming
Building Scalable Mobile Projects: Fast Builds, High Reusability and Clear Ownership
cyrilmottier
2
320
RuboCop: Modularity and AST Insights
koic
2
1.9k
音声プラットフォームのアーキテクチャ変遷から学ぶ、クラウドネイティブなバッチ処理 (20250422_CNDS2025_Batch_Architecture)
thousanda
0
320
KawaiiLT 登壇資料 キャリアとモチベーション
hiiragi
0
150
파급효과: From AI to Android Development
l2hyunwoo
0
140
実践Webフロントパフォーマンスチューニング
cp20
36
8.6k
Ruby's Line Breaks
yui_knk
2
1.8k
Boost Your Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
330
サービスクラスのありがたみを発見したときの思い出 #phpcon_odawara
77web
4
690
SwiftDataのカスタムデータストアを試してみた
1mash0
0
120
七輪ライブラリー: Claude AI で作る Next.js アプリ
suneo3476
1
130
State of Namespace
tagomoris
4
2.1k
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
227
22k
How STYLIGHT went responsive
nonsquared
100
5.5k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.7k
Visualization
eitanlees
146
16k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
47
2.7k
A Tale of Four Properties
chriscoyier
158
23k
StorybookのUI Testing Handbookを読んだ
zakiyama
29
5.7k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
135
33k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.4k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.5k
Rails Girls Zürich Keynote
gr2m
94
13k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
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/819284?email=yurenju@gmail.com verifyEmail(“819284”, “yurenju@gmail.com”).execute();
Implementing an API method
Parameters Mapping http://<DOMAIN-NAME>/api/emails/819284?email=yurenju@gmail.com
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