flutterlocation icon indicating copy to clipboard operation
flutterlocation copied to clipboard

blocking when call getLocation()

Open sleepreading opened this issue 4 years ago • 10 comments

Environment:

Flutter 2.2.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f4abaa0735 (2 weeks ago) • 2021-07-01 12:46:11 -0700 Engine • revision 241c87ad80 Tools • Dart 2.13.4

Location location = new Location();

bool _serviceEnabled;
PermissionStatus _permissionGranted;
LocationData _locationData;

_serviceEnabled = await location.serviceEnabled();
if (!_serviceEnabled) {
  _serviceEnabled = await location.requestService();
  if (!_serviceEnabled) {
    return;
  }
}

_permissionGranted = await location.hasPermission();
if (_permissionGranted == PermissionStatus.denied) {
  _permissionGranted = await location.requestPermission();
  if (_permissionGranted != PermissionStatus.granted) {
    return;
  }
}

_locationData = await location.getLocation();   // <-- here will block for ever

Device:

HuaWei Honor 10
EMUI: 10.0.0
Android: 4.14.116

sleepreading avatar Jul 19 '21 03:07 sleepreading

Any updates on this issue?

ahmetcj4 avatar Jul 28 '21 09:07 ahmetcj4

Haven't seen any progress yet

sleepreading avatar Jul 30 '21 00:07 sleepreading

I have the same problem :(

LostInDarkMath avatar Aug 05 '21 19:08 LostInDarkMath

same problem on iOS

cmorsucci avatar Aug 28 '21 08:08 cmorsucci

I've found a workaround for this: https://github.com/Lyokone/flutterlocation/issues/621#issuecomment-931597019

LostInDarkMath avatar Sep 30 '21 19:09 LostInDarkMath

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 16 '22 18:04 stale[bot]

Let's remove the inactive label, because only the maintainer is inactive.

LostInDarkMath avatar Apr 16 '22 18:04 LostInDarkMath

By the way, I have switched to geolocator since last year and everything looks fine.

sleepreading avatar Apr 18 '22 01:04 sleepreading

Isn't it because you're using a Huawei device?

bartekpacia avatar Aug 09 '23 22:08 bartekpacia

I have a Xiaomi Device and the same issue.

LostInDarkMath avatar Aug 10 '23 07:08 LostInDarkMath