I have JSON string created by Gson library and I want to send this string with HttpURLConnection API "GET" to the localhost server(wamp). I will run the app on my S4 device that is connected with my laptop vie the USB cabel.
I appreciate any help.
I have this JSON string:
{
"latitude":80.86907321,
"longitude":15.66542435,
"formatted":"22.04.2015 11:11:00",
"route":4
}
I have this method in the inner class "MyLocationListener":
private String convertToJSON(double pLong, double pLat, String formatted) {
//envelop the data in JSON format.
Data d = new Data(pLat, pLong, formatted,route_number);
Gson gson = new GsonBuilder().registerTypeAdapter(Data.class, new DataSerializer()).create();
return gson.toJson(d);
}