Cedric
Cedric

Reputation: 21

Best way to transmit sqlite data to a web server from an Android Unit?

The title almost says it all.

I'm building an Android App to collect data on sites. The data is stored in a sqlite database on the unit.

I'd like to transmit them to a web server over wifi. The data is to be stored in sql form and analysed on the web server, then graphed on a web page.

I though about making a csv and send it to a php page that would parse it and write it to the server sql database. I saw alson json, but must read more about it.

What are the best options to have the data transfered with integrity ?

Thanks a lot

Upvotes: 2

Views: 672

Answers (2)

zeitkunst
zeitkunst

Reputation: 505

As an additional option you can use Google's protocol buffers. With protobuf you have to include an additional library and write your data in a specific message format, but you gain an automatically generated library with getter/setter methods and the data is sent in binary form. All you have to do on either end is send/receive the number of bytes of the message and then write/read the message itself; the library takes care of populating all of your instance variables.

Of course this depends on what language you are using on the server, as you have to use a protobuf library there as well; but it would appear that there are many different language bindings, including for PHP.

Upvotes: 0

nicholas.hauschild
nicholas.hauschild

Reputation: 42834

I would recommend using JSON for a couple reasons:

  1. It is human readable.
  2. There are nice libraries for JSON-Object Mapping, such as Jackson or GSON.
  3. There are JSONObject/JSONArray classes that are a part of Android that are easy to use.

Upvotes: 1

Related Questions