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
150
Impossible Election for recall in Taiwan
yurenju
1
410
物資管理系統與災民證
yurenju
0
890
JavaScript 開發流程自動化懶人包
yurenju
38
6k
Code Coverage -- Javascript Frontend + Backend
yurenju
14
7.9k
Loopback + Angular.js
yurenju
3
520
bifrost 物資管理系統
yurenju
4
270
Gaia Build System introduction
yurenju
2
190
Other Decks in Programming
See All in Programming
ECSのサービス間通信 4つの方法を比較する 〜Canary,Blue/Greenも添えて〜
tkikuc
11
2.3k
Go言語でターミナルフレンドリーなAIコマンド、afaを作った/fukuokago20_afa
monochromegane
2
140
RailsのPull requestsのレビューの時に私が考えていること
yahonda
5
1.7k
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
430
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
210
Honoの来た道とこれから
yusukebe
19
3k
詳細解説! ArrayListの仕組みと実装
yujisoftware
0
480
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
1
250
Vue3の一歩踏み込んだパフォーマンスチューニング2024
hal_spidernight
3
3.1k
2万ページのSSG運用における工夫と注意点 / Vue Fes Japan 2024
chinen
3
1.3k
のびしろを広げる巻き込まれ力:偶然を活かすキャリアの作り方/oso2024
takahashiikki
1
410
生成 AI を活用した toitta 切片分類機能の裏側 / Inside toitta's AI-Based Factoid Clustering
pokutuna
0
580
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
93
13k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.6k
Designing for humans not robots
tammielis
249
25k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
228
52k
RailsConf 2023
tenderlove
29
880
A Modern Web Designer's Workflow
chriscoyier
692
190k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Unsuck your backbone
ammeep
668
57k
Designing Experiences People Love
moore
138
23k
Done Done
chrislema
181
16k
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