I am creating an android app which stores data such as "name" "latitude" "longitude" in a MSSQL database.
I am planning to connect the android app to a server which then connects to a mssql database server.
I have established the Java -> MSSQL connection fine and can read/write data with no problems.
Now I want to be able to send / receive these objects between the java server and the android app.
I created 'file.json' and stored it on a web server containing:
{"name":"shopname","address":"123 fake street","type":"unknown", "notes":"service is really good."}
and I am able to pull this data back into an object with no trouble.
My question is:
How do I get the java server to serve this data to my android app? I want to be able to use:
URL objectGet = new URL("http://10.0.1.8/file.json");
URLConnection yc = objectGet.openConnection();
BufferedReader in = new BufferedReader(
new InputStreamReader(
yc.getInputStream()));
and then
DataObject objs = gson.fromJson(in, DataObject.class);
What would be the best way of setting this up?