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
170
Impossible Election for recall in Taiwan
yurenju
1
430
物資管理系統與災民證
yurenju
0
920
JavaScript 開發流程自動化懶人包
yurenju
38
6k
Code Coverage -- Javascript Frontend + Backend
yurenju
14
8k
Loopback + Angular.js
yurenju
3
530
bifrost 物資管理系統
yurenju
4
280
Gaia Build System introduction
yurenju
2
190
Other Decks in Programming
See All in Programming
PHPとAPI Platformで作る本格的なWeb APIアプリケーション(入門編) / phpcon 2024 Intro to API Platform
ttskch
0
390
functionalなアプローチで動的要素を排除する
ryopeko
1
220
watsonx.ai Dojo #6 継続的なAIアプリ開発と展開
oniak3ibm
PRO
0
170
情報漏洩させないための設計
kubotak
5
1.3k
20241217 競争力強化とビジネス価値創出への挑戦:モノタロウのシステムモダナイズ、開発組織の進化と今後の展望
monotaro
PRO
0
290
良いユニットテストを書こう
mototakatsu
11
3.6k
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
1.4k
GitHub CopilotでTypeScriptの コード生成するワザップ
starfish719
26
6k
Scaling your build logic
antalmonori
1
100
生成AIでGitHubソースコード取得して仕様書を作成
shukob
0
630
月刊 競技プログラミングをお仕事に役立てるには
terryu16
1
1.2k
知られざるDMMデータエンジニアの生態 〜かつてツチノコと呼ばれし者〜
takaha4k
1
450
Featured
See All Featured
Speed Design
sergeychernyshev
25
740
Mobile First: as difficult as doing things right
swwweet
222
9k
Code Review Best Practice
trishagee
65
17k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2k
Visualization
eitanlees
146
15k
Unsuck your backbone
ammeep
669
57k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
How to Ace a Technical Interview
jacobian
276
23k
Building Your Own Lightsaber
phodgson
104
6.2k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
BBQ
matthewcrist
85
9.4k
Navigating Team Friction
lara
183
15k
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