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
130
Code For America 見聞錄 - 社會安全網
yurenju
0
210
Impossible Election for recall in Taiwan
yurenju
1
460
物資管理系統與災民證
yurenju
0
970
JavaScript 開發流程自動化懶人包
yurenju
38
6k
Code Coverage -- Javascript Frontend + Backend
yurenju
14
8k
Loopback + Angular.js
yurenju
3
560
bifrost 物資管理系統
yurenju
4
290
Gaia Build System introduction
yurenju
2
200
Other Decks in Programming
See All in Programming
PipeCDのプラグイン化で目指すところ
warashi
1
310
#QiitaBash MCPのセキュリティ
ryosukedtomita
1
1.5k
「App Intent」よくわからんけどすごい!
rinngo0302
1
110
マッチングアプリにおけるフリックUIで苦労したこと
yuheiito
0
190
MCPを使ってイベントソーシングのAIコーディングを効率化する / Streamlining Event Sourcing AI Coding with MCP
tomohisa
0
170
PicoRuby on Rails
makicamel
3
140
AI コーディングエージェントの時代へ:JetBrains が描く開発の未来
masaruhr
1
200
顧客の画像データをテラバイト単位で配信する 画像サーバを WebP にした際に起こった課題と その対応策 ~継続的な取り組みを添えて~
takutakahashi
4
1.3k
状態遷移図を書こう / Sequence Chart vs State Diagram
orgachem
PRO
2
210
Git Sync を超える!OSS で実現する CDK Pull 型デプロイ / Deploying CDK with PipeCD in Pull-style
tkikuc
4
360
生成AI時代のコンポーネントライブラリの作り方
touyou
1
290
NEWT Backend Evolution
xpromx
1
140
Featured
See All Featured
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
8
700
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
138
34k
Optimizing for Happiness
mojombo
379
70k
Adopting Sorbet at Scale
ufuk
77
9.5k
Gamification - CAS2011
davidbonilla
81
5.4k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
31
1.3k
The Cost Of JavaScript in 2023
addyosmani
51
8.6k
Facilitating Awesome Meetings
lara
54
6.5k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Bash Introduction
62gerente
613
210k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.4k
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