best-flutter / flutter_amap_location

高德地图flutter定位组件
MIT License
274 stars 70 forks source link

获取定位返回接口为空 #47

Open 553559555 opened 4 years ago

553559555 commented 4 years ago

` void initState() { super.initState(); setState(() { this.isLoading = true; });

AMapLocationClient.startup(new AMapLocationOption(
    desiredAccuracy: CLLocationAccuracy.kCLLocationAccuracyHundredMeters));

getCurrentLocation();

} Future requestPermission() async { final permissions = await PermissionHandler() .requestPermissions([PermissionGroup.location]);

if (permissions[PermissionGroup.location] == PermissionStatus.granted) {
  return true;
} else {
  CLToast.showToast('需要定位权限');
  return false;
}

}

Future getCurrentLocation() async { if (await requestPermission()) { AMapLocation loc = await AMapLocationClient.getLocation(true); log('123123123' + loc.latitude.toString() + loc.longitude.toString()); setState(() { this._location = loc; }); } }`

D/AmapLocationPugin( 4608): 定位获取结果:0.0 code:7 省: D/AmapLocationPugin( 4608): 定位获取结果:0.0 code:7 省: