Bala
Bala

Reputation: 390

If i have a DB on the server, what is the best approach to query for data from my android app?

Im new to android development. I realized if DB were to be on the phone updating it would be tedious. So though keeping DB on the server is better of but retrieving data from DB to App is what im having doubts with.

Upvotes: 0

Views: 162

Answers (2)

kosa
kosa

Reputation: 66637

The approach you may need to choose will be, have a service hosted on your server (could be written in any programming language) which retrieves/posts data from database and sends data in either JSON/XML format ( I did JSon format) to app. In your app use HTTPClient to get/post data to service hosted on your server. Parse the data using Android in built JSon API.

Upvotes: 2

Jon Douglas
Jon Douglas

Reputation: 13176

You cannot connect directly to the DB, you will need a web service to do so. Look at the http.client to help you get started on this.

SQLite would be the best choice depending on what you're creating your application for.

Upvotes: 3

Related Questions