我已经得到了我需要的坐标和其他参数。我用它发布到我的服务器:
String postData = "{\"request\":{\"type\":\"locationinfo\"},\"userinfo\":{\"latitude\":\""+latitude+"\",\"longitude\":\""+longitude+"\",\"speed\":\""+speed+"\"}}";
HttpClient httpClient = new DefaultHttpClient();
// Post method to send data to server
HttpPost post = new HttpPost();
try {
post.setURI(new URI("http://10.0.2.15:80"));
} catch (URISyntaxException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// set your post data inside post method
try {
post.setEntity(new StringEntity(postData));
} catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// execute post request here
try {
HttpResponse response = httpClient.execute(post);
} catch (ClientProtocolException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
我怎么确定它已经到达服务器?如何查看服务器上的坐标?我想将值保存在数据库中并对其进行处理。