问题描述
有关如何为黑莓和J2ME手机做电池三角任何想法?我知道如何让小区ID,但我不能这样做三角测量。
Any ideas about how to do cell triangulation for Blackberry and J2ME phones? I know how to get the cell id but I couldn't do triangulation.
推荐答案
如果你可以做一个HTTP POST到任意波形的网站,你可以使用谷歌的的。
If you can do an HTTP Post to an arbitray website, you can use Google's geolocation api.
只要邮政以下JSON格式的数据。
Simply POST data in the following JSON format to https://www.google.com/loc/json.
请参阅如何更多信息从无线网络等添加到您的JSON,大大提高了结果的准确性上面的链接。而且要特别注意移动全国code,得到它是not明显。
See the above link on how to add more information to your json from wifi etc. to greatly increase the accuracy of the result. And pay special attention to the mobile country code, getting it is not obvious.
{
"version": "1.1.0",
"cell_towers": [
{
"cell_id": "42",
"location_area_code": 415,
"mobile_country_code": 310,
"mobile_network_code.": 410,
"age": 0,
"signal_strength": -60,
"timing_advance": 5555
},
{
"cell_id": "88",
"location_area_code": 415,
"mobile_country_code": 310,
"mobile_network_code": 580,
"age": 0,
"signal_strength": -70,
"timing_advance": 7777
}
]
}
这将返回的纬度/经度的谷歌的估计你的位置,准确和可选的地缘codeD地址一起。您可以快速测试它例如使用Chrome扩展名为REST控制台。
This will return you Google's estimate of the latitude/longitude on your location, along with accuracy and optionally a geocoded address. You can test it quickly e.g. with the Chrome extension called REST Console.
不过,它似乎是的只提供对当前连接的细胞,没有其他可见但未注册细胞的信息。在这种情况下不能做三角测量,因为你(unsuprisingly)需要三个点三角!然而,定位不准确的径向估计仍然是可能的。
However, it seems that the Blackberry API only provides info on the currently connected cell, not other visible but unregistered cells. In this situation cannot do triangulation, as you (unsuprisingly) need three points to triangulate! However, a less accurate radial estimate of location is still possible.
您仍可以使用谷歌API对于这一点,通过提供只有一个塔,或者您可以使用的如果你选择。你可能想既来测试和比较的准确性。该爱立信API是一个类似JSON API,谷歌的,但只需要一个单细胞作为输入。 A 教程可用,但它归结为这样的JSON请求:
You can still use the Google API for this, by providing only one tower, or you can use the Ericsson API if you choose. You might want to test with both and compare the accuracy. The Ericcson API is a similar JSON api to Google's, but only expects a single cell as input. A tutorial is available, but it boils down to a JSON request like this:
StringBuffer url = new StringBuffer();
url.append("http://cellid.labs.ericsson.net/json/lookup");
url.append("?cellid=").append(cell.getCellId());
url.append("&mnc=").append(cell.getMnc());
url.append("&mcc=").append(cell.getMcc());
url.append("&lac=").append(cell.getLac());
url.append("&key=").append(API_KEY);
try {
byte[] data = getHttp(url.toString());
if(data!=null) {
JSONObject o = new JSONObject(new String(data));
JSONObject pos = o.getJSONObject("position");
this.longitude = pos.getDouble("longitude");
this.latitude = pos.getDouble("latitude");
this.accuracy = pos.getDouble("accuracy");
this.cellName = pos.optString("name");
}
} catch (IOException e) {
e.printStackTrace();
}
这篇关于黑莓电池三角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!