I am developing an Android application and I have some data saved locally in a textual file in the Phone.
I would like to save this data in a distant mysql database.
The server where the database is contain a java server (GlassFish) running a RESTFul web service, the REST service is responsible of updating the database.
As I am new in all these domains (excuse my questions if they are basic), I think that the locally saved data should be sent to the server thought httpPost request.
My file (where is saved my data) contain several lines, each line correspond to on JSON object that should be sent to the server, so the file is textual but written as JSON objects.
My question is: what is the best way to send the data to the server? I there anyway to do HttpPost command for the whole file containing? or I should open the file and read it one line by one line and create a JSON object each time and send it by a new HttpPost command?
Thank you for you help and excuse my question if it is basic or stupid.
In case you don’t get any answers from smarter/more experienced folks, I would go with reading the file and posting each JSON object (by which I assume you mean something like doing a post on a URL /…./myObjects with a JSON representation of myObject.