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
3.3k
5
Share
Using Google APIs Client for Android
Yuren Ju
October 28, 2012
More Decks by Yuren Ju
See All by Yuren Ju
Taste Cucumber.js - JavaScript BDD Framework
yurenju
0
180
Code For America 見聞錄 - 社會安全網
yurenju
0
240
Impossible Election for recall in Taiwan
yurenju
1
520
物資管理系統與災民證
yurenju
0
1.1k
JavaScript 開發流程自動化懶人包
yurenju
38
6.1k
Code Coverage -- Javascript Frontend + Backend
yurenju
14
8.1k
Loopback + Angular.js
yurenju
3
600
bifrost 物資管理系統
yurenju
4
320
Gaia Build System introduction
yurenju
2
210
Other Decks in Programming
See All in Programming
要はバランスからの卒業 #yumemi_grow
kajitack
0
190
AI駆動開発勉強会 広島支部 第一回勉強会 AI駆動開発概要とワークショップ
hayatoshimiu
0
370
Oxlintはいかにしてtsgolintのlint ruleを呼び出しているのか
syumai
1
490
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
6
1.4k
次世代リンターで探る、tsgo 時代における型認識カスタムルールの現実解
ytakahashii
1
980
CLIであることを活かしたGitHub Copilot CLI活用術 / GitHub Copilot CLI Pro Tips & Tricks
nao_mk2
1
1k
Spec-Driven Development with AI-Agents: From High-Level Requirements to Working Software
antonarhipov
2
330
サークル参加から学ぶ、小さな事業の回し方
yuzneri
0
230
AI Agent と正しく分析するための環境作り
yoshyum
2
600
AI時代だからこそ「Bloc」を採用する価値があるのかもしれない
takuroabe
0
240
Sans tests, vos agents ne sont pas fiables
nabondance
0
160
Inside Stream API
skrb
1
160
Featured
See All Featured
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
Faster Mobile Websites
deanohume
310
31k
The Limits of Empathy - UXLibs8
cassininazir
1
340
Why Our Code Smells
bkeepers
PRO
340
58k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
WCS-LA-2024
lcolladotor
0
600
Building the Perfect Custom Keyboard
takai
2
770
Optimising Largest Contentful Paint
csswizardry
37
3.7k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.7k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
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