【发布时间】:2010-07-01 10:35:11
【问题描述】:
我正在探索从 android 扫描 ssid 和 rssi,我能够做到,但现在我想将数据发送到服务器,所以我探索了我在下面找到的代码
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://101.34.45.45/rawData");
try {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(3);
nameValuePairs.add(new BasicNameValuePair("userId", "00-22-68-E8-EC-F1"));
nameValuePairs.add(new BasicNameValuePair("timestamp", "2010-07-01 11:11:11"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
textView.setText(response.toString());
} catch (ClientProtocolException e) {
} catch (IOException e) {
}
但现在我在添加多个 wifi 数据时遇到问题,格式应如下所示
http://101.34.45.45/rawData?data={"userId":"guest1","timestamp":"2010-07-01 08:58:23","wifi":[{"ssid":"guest","rssi": "40"},{"ssid":"guest1","rssi":"80"}]},
那么wifi参数怎么做,谁能帮忙,我还在尝试几个品种,
谢谢
【问题讨论】:
标签: android http httpclient http-post