Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
553559555 opened this issue Jun 17, 2020 · 0 comments
Open

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

553559555 opened this issue Jun 17, 2020 · 0 comments

Comments

@553559555
Copy link

`
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 省:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant