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.2k
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
110
Code For America 見聞錄 - 社會安全網
yurenju
0
160
Impossible Election for recall in Taiwan
yurenju
1
420
物資管理系統與災民證
yurenju
0
910
JavaScript 開發流程自動化懶人包
yurenju
38
6k
Code Coverage -- Javascript Frontend + Backend
yurenju
14
7.9k
Loopback + Angular.js
yurenju
3
530
bifrost 物資管理系統
yurenju
4
270
Gaia Build System introduction
yurenju
2
190
Other Decks in Programming
See All in Programming
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
830
php-conference-japan-2024
tasuku43
0
320
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1.2k
ChatGPT とつくる PHP で OS 実装
memory1994
PRO
2
110
今年一番支援させていただいたのは認証系サービスでした
satoshi256kbyte
1
260
Keeping it Ruby: Why Your Product Needs a Ruby SDK - RubyWorld 2024
envek
0
190
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
280
Mermaid x AST x 生成AI = コードとドキュメントの完全同期への道
shibuyamizuho
0
160
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
190
どうして手を動かすよりもチーム内のコードレビューを優先するべきなのか
okashoi
3
190
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
270
Spatial Rendering for Apple Vision Pro
warrenm
0
110
Featured
See All Featured
4 Signs Your Business is Dying
shpigford
181
21k
GitHub's CSS Performance
jonrohan
1030
460k
The Cost Of JavaScript in 2023
addyosmani
45
7k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2k
Music & Morning Musume
bryan
46
6.2k
Side Projects
sachag
452
42k
Producing Creativity
orderedlist
PRO
341
39k
Why Our Code Smells
bkeepers
PRO
335
57k
Being A Developer After 40
akosma
87
590k
Git: the NoSQL Database
bkeepers
PRO
427
64k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
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