Android: Pulling data from a server?
I'm a newbie when it comes to client/server apps but I have an idea for an app but need a few ideas on 开发者_StackOverflow社区how to implement it. I want users to be able to submit say a post and the server would store it. Other users will be able to also submit posts...the posts will then be able to be viewed as a list updated from the server. What is the best way to ndo this with android? JSON? SQL? What have you found easy? Thanks any suggestions are much appreciated!
Write a server component with your app-specific services, such as creating a post, retrieving all posts, etc. JSON is a simple and good choice.
Use DefaultHttpClient
or AndroidHttpClient
for communicating with your server via HTTP:
- http://developer.android.com/reference/org/apache/http/impl/client/DefaultHttpClient.html
- http://developer.android.com/reference/android/net/http/AndroidHttpClient.html
- http://developer.android.com/reference/android/net/package-summary.html
Use the org.json
package to create requests and parse responses:
- http://developer.android.com/reference/org/json/package-summary.html
These packages and classes are basically available on all Android devices, and they are fairly easy to use.
- DefaultHttpClient or AndroidHttpClient for communication
- Android JSON library or for large data Jackson Streaming API
- SQLiteDatabase
- C2DM to push messages or Deacon project for custom server
Everything is built into Android SDK except Jackson and Deacon
精彩评论