在Android手机中,计算距离GPS的最佳方法是什么?
我正在开发一个应用程序,它每60秒捕获一次用户的纬度和经度,并计算出用户行驶的距离。 有时我的手机在同一个位置停留了一个多小时,但GPS跳转到不同的位置,导致错误的距离计算在Android手机中,计算距离GPS的最佳方法是什么?,android,gps,android-gps,Android,Gps,Android Gps,我正在开发一个应用程序,它每60秒捕获一次用户的纬度和经度,并计算出用户行驶的距离。 有时我的手机在同一个位置停留了一个多小时,但GPS跳转到不同的位置,导致错误的距离计算 如何减少gps跳转并提高距离精度?整个会话中gps的精度将不一致。但有办法克服这一点。即使用户不改变位置,纬度、经度值仍会在连续的时间段内有所不同。查看以下如何修改这些异常的方法 // for location updates private int locationupdate = 8000; //in milliseco
如何减少gps跳转并提高距离精度?整个会话中gps的精度将不一致。但有办法克服这一点。即使用户不改变位置,纬度、经度值仍会在连续的时间段内有所不同。查看以下如何修改这些异常的方法
// for location updates
private int locationupdate = 8000; //in milliseconds
private int locationdistance = 10; // in meters
创建位置请求时,根据您的要求提及setSmallestDisplacement
以及setInterval
,如下所示
protected void createLocationRequest() {
locationRequest = new LocationRequest();
locationRequest.setInterval(locationupdate); //in milliseconds
locationRequest.setFastestInterval(5000); //in milliseconds
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
locationRequest.setSmallestDisplacement(locationdistance);
}
查看了解更多信息GPS的精度在整个课程中并不一致。但有办法克服这一点。即使用户不改变位置,纬度、经度值仍会在连续的时间段内有所不同。查看以下如何修改这些异常的方法
// for location updates
private int locationupdate = 8000; //in milliseconds
private int locationdistance = 10; // in meters
创建位置请求时,根据您的要求提及setSmallestDisplacement
以及setInterval
,如下所示
protected void createLocationRequest() {
locationRequest = new LocationRequest();
locationRequest.setInterval(locationupdate); //in milliseconds
locationRequest.setFastestInterval(5000); //in milliseconds
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
locationRequest.setSmallestDisplacement(locationdistance);
}
查看更多信息如果定位精度不够好,请检查定位精度,不要使用
如果定位精度不够好,就必须检查定位精度,不要使用它
GPS跳跃取决于手机使用的GPS天线的质量。这意味着,手机的GPS天线会更好,因此精确度也会更好。除此之外,您还可以使用一些逻辑来计算距离,但这会导致延迟。GPS跳转取决于您手机使用的GPS天线的质量。这意味着,手机的GPS天线会更好,因此精确度也会更好。否则,您可以使用一些逻辑来计算距离,但这会导致延迟。