Android 百度地图定位半径圈范围自定义

来源:互联网 发布:百分百客户采集软件 编辑:程序博客网 时间:2024/05/16 02:34

项目需求百度定位的半径为500米,但是加载下来后的定位半径为100米(默认大小)。

查询了好久资料才发现,原来这个所谓的半径圈表示百度地图的半径误差值大小。

在百度地图的API中,BDLocationListener,定位的返回监听事件中设置即可。

locData.direction = location.getDerect();为原来demo的参数,获取默认误差大小。

public class MyLocationListenner implements BDLocationListener {@Overridepublic void onReceiveLocation(final BDLocation location) {if (location == null)return;locData.latitude = location.getLatitude();locData.longitude = location.getLongitude();locData.direction = 2.0f;//locData.accuracy = location.getRadius();//获取默认误差半径locData.accuracy = 500;//自定义误差半径locData.direction = location.getDerect();myLocationOverlay.setData(locData);mMapView.refresh();public void onReceivePoi(BDLocation poiLocation) {if (poiLocation == null) {return;}}}


0 0
原创粉丝点击