Más contenido relacionado La actualidad más candente (18) Similar a Web Services and Android - OSSPAC 2009 (20) Web Services and Android - OSSPAC 20093. • HTTP
• OAuth
• XML
• JSON
9. “An open protocol to allow secure API
authorization in a simple and standard method
from desktop and web applications”
10. • use OAuth to access protected data
• your application needs to obtain an access
token from the service provider
• service provider will issue access token
after the user grants permission
12. +
jfireeagle
http://code.google.com/p/jfireeagle/wiki/Android
jpoco
http://code.google.com/p/jpoco/wiki/Android
13. + HTTP
Option 1
• java.net.URL
• java.net.HttpURLConnection
Option 2
• HttpClient 4.0 API
14. HttpClient 4.0 API
• org.apache.http.client.HttpClient
• org.apache.http.impl.client.DefaultHttpClient
15. 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
16. HttpClient 4.0 API
• org.apache.http.HttpResponse
• org.apache.http.StatusLine
• org.apache.http.HttpEntity
• org.apache.http.utils.EntityUtils
19. UI programming
• user clicks on button
• onClick listener
• Don’t block the UI thread!
• Tip: use java.lang.Runnable
21. 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.0 or 1.1
22. JSON processing
• org.json package
• Google GSON library *
• XStream + Jettison
*
• json-lib
*
* does not work on Android 1.0 or 1.1
23. RSS and Atom
• Rome library *
• Apache Abdera library *
* does not work on Android 1.0 or 1.1
24. Client libraries
code.google.com/p/jfireeagle
code.google.com/p/jpoco
code.google.com/p/meetup-java-client
25. Client libraries
code.google.com/p/gdata-java-client
code.google.com/p/upcoming-java-client
flickrj.sourceforge.net
28. Resources
• http://code.google.com/android/documentation.html
• http://hc.apache.org/httpcomponents-client
• http://code.google.com/p/oauth
• http://xstream.codehaus.org