造成这个问题的因素有很多,我这里只是把自己踩的坑分享出来,不保证适合所有人。
如果你集成了百度定位SDK,但是最终获取定位信息为空,并且检查了权限服务等一系列步骤都没有问题。在你百思不得其解的时候,请看:
public BDLocationInstance(Context context , BDAbstractLocationListener listener) {
//通过LocationClientOption设置LocationClient相关参数
LocationClientOption option = new LocationClientOption();
option.setOpenGps(true); // 打开gps
option.setCoorType("bd09ll"); // 设置坐标类型
option.setScanSpan(1000);
option.setIsNeedAddress(true);
client = new LocationClient(context,option);
client.registerLocationListener(listener);
}
注意到“option.setIsNeedAddress(true);”这一行代码,这应该是设置需要地址,加上这一句就可以了。希望可以帮助大家。