您的位置:首页 > 大数据 > 人工智能

百度地图 baiduMap(二) 定位

2016-05-04 00:42 447 查看
地图定位 因为是虚拟机 没有信号,点位的是原点,

// 管理地图
BaiduMap baiduMap;
// 定位客户端
LocationClient locationClient;


// 2.4 让框架中的接口指向实现类
locationClient = new LocationClient(this.getActivity());
// 实现类
MyBdlocationListener myBdlocationListener = new MyBdlocationListener();
locationClient.registerLocationListener(myBdlocationListener);
//开始
locationClient.start();


// 2.3 写实现类
class MyBdlocationListener implements BDLocationListener {
@Override
public void onReceiveLocation(BDLocation bdLocation) {
try {
//4.9E-324
// 纬度
double latitude = bdLocation.getLatitude();
// 经度
double longitude = bdLocation.getLongitude();
Log.i("接收坐标", "纬度=" + latitude + ",经度=" + longitude);
} catch (Exception e) {
e.printStackTrace();
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: