我想在我的应用程序中使用精细的 GPS 位置。所以我遵循了一个简单的教程(LocationManager 的基本用法,明确要求 GPS 提供商,要求更新 0 ms, 0 m )并创建一个应用程序。我对更新的准确性和速度完全没有印象。它很慢,最佳精度为 24 米,但平均为 96 米。
在同一部手机上,我在同一地点运行广为人知的GPS STATUS。我很惊讶地看到修复是多么准确。4-6 米,始终如一。
所以我关闭了 GPS 状态并运行我的应用程序 - 我看到精度为 6 米,但几秒钟后它是 24、56、90、128 ......并在 96 左右波动。
现在,我想知道:这怎么可能?有没有提高准确率的技巧?!
有人有很好的例子/教程吗?
它没有帮助
让我再说一遍:我获取并打印所有更新。所以我准确地看到了一系列位置。
我看到了波动,我看到了最好的结果,而且永远不会比 12 米更好。
现在在同一个位置,我启动 GPS Status =>,我看到精度如何达到 4 米!
首先我想:哈,GPS 状态作弊,只是决定了准确性
但似乎并非如此,因为当我打开我的应用程序并获得 lastknown 位置时,它确实是准确度为 4 的位置!
并开始降级到最佳情况 12。
总结:相同的硬件,相同的条件,不同的应用 => 不同的准确性!
所以我的问题是:有什么技巧吗?有什么额外的命令吗?有什么特殊的电源设置吗?与“你的应用程序有多重”有任何关系吗?
小智 -1
这个怎么样?
-设定精度+设定功率要求高:
try{
locator = new GeoLocator(this);
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationManager.addGpsStatusListener(new GPSStatusManager(locationManager));
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
criteria.setPowerRequirement(Criteria. POWER_HIGH);
bestProvider = locationManager.getBestProvider(criteria, true);
Bundle bundle = new Bundle();
//I copied the next two lines out of some tutorial hoping that they would help boost my gps, but I'm really not sure what they do
boolean xtraInjection=locationManager.sendExtraCommand(LocationManager.GPS_PROVIDER,
"force_xtra_injection",bundle);
boolean timeInjection=locationManager.sendExtraCommand(LocationManager.GPS_PROVIDER,
"force_time_injection",bundle);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0.0f, locator);
}catch(Exception e){}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7377 次 |
| 最近记录: |