Connecting to Web Services on Android June 2 2010
Upcoming SlideShare
Loading in...5
×
 

Connecting to Web Services on Android June 2 2010

on

  • 10,972 views

Open Source Bridge 2010

Open Source Bridge 2010
June 2, 2010
Portland Oregon

Statistics

Views

Total Views
10,972
Views on SlideShare
10,898
Embed Views
74

Actions

Likes
1
Downloads
389
Comments
0

5 Embeds 74

http://www.slideshare.net 35
http://www.cxybase.com 33
http://cache.baidu.com 3
http://www.codesee.com 2
http://www.verious.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Connecting to Web Services on Android June 2 2010 Connecting to Web Services on Android June 2 2010 Presentation Transcript

    • Connecting to Web Services on Android Sean Sullivan June 2, 2010
    • HTTP request HTTP response
    • • HTTP • XML • JSON • OAuth
    • + HTTP Option 1 • java.net.URL • java.net.HttpURLConnection Option 2 • HttpClient 4.0 API
    • HttpClient 4.0 API • org.apache.http.client.HttpClient • org.apache.http.impl.client.DefaultHttpClient
    • HttpClient 4.0 API • org.apache.http.client.methods.HttpGet • org.apache.http.client.methods.HttpPost • org.apache.http.client.methods.HttpPut • org.apache.http.client.methods.HttpDelete
    • HttpClient 4.0 API • org.apache.http.HttpResponse • org.apache.http.StatusLine • org.apache.http.HttpEntity • org.apache.http.utils.EntityUtils
    • HttpClient programming • HTTP response status code • I/O exceptions • timeouts • gzip
    • HttpClient programming synchronous invocation public HttpResponse execute(HttpUriRequest request) asynchronous invocation public HttpResponse execute(HttpUriRequest request, ResponseHandler handler)
    • UI programming • user clicks on button • onClick listener • Don’t block the UI thread! • Tip: use java.lang.Runnable
    • Response formats • XML • JSON • RSS, Atom • other
    • JSON processing • json.org package • Google GSON library • XStream + Jettison * • json-lib * * does not work on Android 1.x
    • XML processing • org.w3c.dom package (DOM) • org.xml.sax package (SAX) • org.xmlpull package (XPP) • XStream • JDOM • Apache XmlBeans* * does not work on Android 1.x
    • RSS and Atom • Rome library * • Apache Abdera library * * does not work on Android 1.x
    • Client libraries code.google.com/p/jfireeagle code.google.com/p/jpoco code.google.com/p/meetup-java-client
    • Client libraries code.google.com/p/gdata-java-client code.google.com/p/upcoming-java-client flickrj.sourceforge.net
    • Conclusion • HttpClient API • use XStream for XML processing • use Google GSON for JSON processing • OAuth has a learning curve
    • Thank you