0
我已经得到了我需要的坐标和其他参数。我用这张贴到我的服务器:我如何在服务器上访问(请参阅)我从Android发送到服务器的GPS坐标?
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();
}
我怎么确定它已经到服务器?我如何看到服务器上的坐标? 我想将这些值保存在数据库中并处理它们。
但我如何确认它已经到服务器? – user1698122 2013-04-28 14:53:55
据我所知,你想知道服务器是否从客户端获取数据,对吗?如果是这样,只要发回你收到的东西!可能是我误会了。你可以写更多的细节或举例。 – 2013-04-28 15:06:56