【发布时间】:2017-04-02 09:53:54
【问题描述】:
我正在使用具有 PRIORITY_HIGH_ACCURACY 模式的融合位置提供程序进行位置轮询,但有时它会给出错误的位置速度,例如 77 m/s。这是错误的,我如何才能获得正确的位置速度?
位置请求:
mLocationRequest = new LocationRequest();
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
mLocationRequest.setInterval(6000);
mLocationRequest.setSmallestDisplacement(80);
加快位置更新速度
Double lat = location.getLatitude();
Double lon = location.getLongitude();
float sd = (float) location.getAltitude();
// float ac_speed = sd;
//----- For Testing Purpose---------------//
float ac_speed = location.getSpeed();
【问题讨论】:
-
在which is best way to calculate speed in android whether “manual calculation using GPS coordinates” or “location.getSpeed”? 下可以找到一些想法和想法,如果这些是个别错误值,您可以计算最近几次速度的中值以过滤掉突然的峰值。当然,它也会引入一个小的延迟。或者,如果这些位置的
getAccuracy()值不好,您可以简单地忽略任何“坏”位置的速度。
标签: android google-play-services android-fusedlocation