public void OnReceiveLocation(BDLocation location) { // map view 销毁后不在处理新接收的位置 if (location == null || _Activity.mMapView == null) return; MyLocationData locData = new MyLocationData.Builder() .Accuracy(location.Radius) // 此处设置开发者获取到的方向信息,顺时针0-360 .Direction(100).Latitude(location.Latitude) .Longitude(location.Longitude).Build(); _Activity.mBaiduMap.SetMyLocationData(locData); if (_Activity.isFirstLoc) { _Activity.isFirstLoc = false; LatLng ll = new LatLng(location.Latitude, location.Longitude); MapStatusUpdate u = MapStatusUpdateFactory.NewLatLng(ll); _Activity.mBaiduMap.AnimateMapStatus(u); } }
public void OnReceiveLocation(Com.Baidu.Location.BDLocation location) { var context = (BaiduMapSample)Context; var locData = new MyLocationData.Builder() .Accuracy(location.Radius).Latitude(location.Latitude) .Longitude(location.Longitude).Build(); context.mBaiduMap.SetMyLocationData(locData); var latlng = new LatLng(location.Latitude, location.Longitude); var update = MapStatusUpdateFactory.NewLatLng(latlng); context.mBaiduMap.AnimateMapStatus(update); }
public void OnReceiveLocation(BDLocation location) { // map view ���ٺ��ڴ����½��յ�λ�� if (location == null || locationOverlayDemo.mMapView == null) return; MyLocationData locData = new MyLocationData.Builder() .Accuracy(location.Radius) // �˴����ÿ�����ȡ���ķ�����Ϣ��˳ʱ��0-360 .Direction(100).Latitude(location.Latitude) .Longitude(location.Longitude).Build(); locationOverlayDemo.mBaiduMap.SetMyLocationData(locData); if (locationOverlayDemo.isFirstLoc) { locationOverlayDemo.isFirstLoc = false; LatLng ll = new LatLng(location.Latitude, location.Longitude); MapStatusUpdate u = MapStatusUpdateFactory.NewLatLng(ll); locationOverlayDemo.mBaiduMap.AnimateMapStatus(u); } }