百度定位中出现4.9E-324

来源:互联网 发布:编程语言好学吗 编辑:程序博客网 时间:2024/06/05 07:13

public class MyLocationListener implements BDLocationListener {


@Override
public void onReceiveLocation(BDLocation location) {

if(location!=null){
this.location=location;

中添加

//错误代码,如果定位失败会返回这样的经纬度[4.9E-324, 4.9E-324]      

if(62==location.getLocType()||63==location.getLocType()||67==location.getLocType()||(161<location.getLocType() && location.getLocType()<168)){
this.location=null;

}

定位失败,location对象没有意义。

如果一直失败,换手机试试


1 0
原创粉丝点击