百度坐标返回4.9E-324

来源:互联网 发布:去除视频马赛克软件 编辑:程序博客网 时间:2024/06/05 04:12
今天定位返回   I/坐标系~~: :(4.9E-324,4.9E-324)
发起定位
/初始化定位private void initLocationListener() {    locationClient = new LocationClient(this);    locationClient.registerLocationListener(this);    LocationClientOption option = new LocationClientOption();    option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy);//设置定位模式    option.setCoorType("bd09ll");//返回的定位结果是百度经纬度,默认值gcj02    option.setOpenGps(true);    option.setIsNeedAddress(true);    locationClient.setLocOption(option);    locationClient.start();}
//百度定位的回调@Overridepublic void onReceiveLocation(BDLocation location) {    double lat = location.getLatitude();    double lng = location.getLongitude();    if ("4.9E-324".equals(location.getLatitude())) {        showToast("定位失败,请查看手机是否开启了定位权限");    }    addressPoint = lng + "," + lat;    Log.i("坐标系~~", ":(" + addressPoint + ")");    if (!TextUtils.isEmpty(addressPoint)) {        locationClient.unRegisterLocationListener(this);        locationClient.stop();    }    }
莫名其妙的定位结果 查了原因 就是百度定位失败了 百度坐标定位失败 返回坐标默认为4.9E-324,4.9E-324  原因是我在用不同手机做测试时 有的品牌手机默认app安装后 不开启gps定位功能 可以在遇到这个结果是提示手动查询是否开启了应用的这个权限 解决
阅读全文
0 0