Reputation: 641
I'm trying to send GPS data over http request.
The problem is that the GPS data is in double format and nameValuePair.add(new BasicNameValuePair(String, String)
will not allow double values.
How do I send double values or convert the double to a string?
Thanks,
httpclient client = new defaulthttpclient();
httppost post = new httppost("web address");
post.setEntity(new UrlencodedFormEntity(nameValuePairs));
httpresponse response = client.execute(post);
Upvotes: 1
Views: 1021
Reputation: 23556
you may need to use two nameValuePairs to send latitude and longitude separately:
double latitude = currentLocation.getLatitude();
double longitude = currentLocation.getLongitude();
nameValuePairs.add(new BasicNameValuePair("latitude",Double.toString(latitude)));
nameValuePairs.add(new BasicNameValuePair("longitude",Double.toString(longitude)));
Upvotes: 1