android的gps函数accuracy参数,GPS accuracy in Android

Get the estimated accuracy of this location, in meters.

We define accuracy as the radius of 68% confidence. In other words, if you draw a circle centered at this location‘s latitude and longitude, and with a radius equal to the accuracy, then there is a 68% probability that the true location is inside the circle.

In statistical terms, it is assumed that location errors are random with a normal distribution, so the 68% confidence circle represents one standard deviation. Note that in practice, location errors do not always follow such a simple distribution.

This accuracy estimation is only concerned with horizontal accuracy, and does not indicate the accuracy of bearing, velocity or altitude if those are included in this Location.

If this location does not have an accuracy, then 0.0 is returned. All locations generated by the LocationManager include an accuracy.

原文:http://www.cnblogs.com/yeahgis/p/4838364.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Android 提供了两种方式进行定位,一种是使用 GPS 进行定位,另一种是使用网络进行定位。其中,GPS 定位需要设备具备 GPS 硬件,而网络定位则需要设备连接到互联网。 使用 GPS 进行定位: 1. 添加权限 在 AndroidManifest.xml 文件中添加 ACCESS_FINE_LOCATION 权限。 2. 获取位置提供器 使用 LocationManager 类获取位置提供器,如下所示: ```java LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); String provider = LocationManager.GPS_PROVIDER; ``` 其中,provider 参数指定使用 GPS 进行定位。 3. 设置定位参数 设置定位参数,如下所示: ```java LocationRequest locationRequest = LocationRequest.create(); locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); locationRequest.setInterval(1000); locationRequest.setFastestInterval(500); ``` 其中,setPriority 方法指定定位的优先级,PRIORITY_HIGH_ACCURACY 表示使用 GPS 进行定位,setInterval 和 setFastestInterval 方法分别指定定位的时间间隔和最快定位时间间隔。 4. 注册监听器 注册监听器,如下所示: ```java locationManager.requestLocationUpdates(provider, 0, 0, locationListener); ``` 其中,locationListener 参数是一个 LocationListener 对象,用于监听位置变化事件。 5. 获取位置信息 在 LocationListener 的 onLocationChanged 方法中获取位置信息,如下所示: ```java @Override public void onLocationChanged(Location location) { double longitude = location.getLongitude(); double latitude = location.getLatitude(); } ``` 使用网络进行定位: 1. 添加权限 在 AndroidManifest.xml 文件中添加 ACCESS_COARSE_LOCATION 权限。 2. 获取位置提供器 使用 LocationManager 类获取位置提供器,如下所示: ```java LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); String provider = LocationManager.NETWORK_PROVIDER; ``` 其中,provider 参数指定使用网络进行定位。 3. 注册监听器 注册监听器,如下所示: ```java locationManager.requestLocationUpdates(provider, 0, 0, locationListener); ``` 其中,locationListener 参数是一个 LocationListener 对象,用于监听位置变化事件。 4. 获取位置信息 在 LocationListener 的 onLocationChanged 方法中获取位置信息,如下所示: ```java @Override public void onLocationChanged(Location location) { double longitude = location.getLongitude(); double latitude = location.getLatitude(); } ``` 需要注意的是,使用网络进行定位可能会存在一定的误差,但相对来说较为稳定,并且不需要设备具备 GPS 硬件。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值