Flutterlocation: getLocation() never return if user don't accept to use Google location service

Created on 29 Jul 2019  路  13Comments  路  Source: Lyokone/flutterlocation

Describe the bug
On Android, when user is prompted to enable Google location service, if say "No Thanks", the getLocation method hangs and never return. No error is throw.

Expected behavior
Must return the location or some error if it's not possible.

Tested on:

  • Android, API Level 28, simulator and Moto G device
  • iOS, Version 12, simulator and real device (SE). Works fine

Additional logs

  • There's just one log that would indicate something...
W/System  (15921): A resource failed to call release.

Most helpful comment

Workaround:

bool getloc = false;
if (await _location.serviceEnabled()) {
  getloc = true;
} else {
  getloc = await _location.requestService();
}
if (getloc) {
  currentLocation = await _location.getLocation();
}

All 13 comments

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.

This issue should be kept open, as this is still a problem.
On Android, if you deactivate the localisation globally for the phone and authorize it for the app, the getLocation method hangs and never return. No error is throw.

Workaround:

bool getloc = false;
if (await _location.serviceEnabled()) {
  getloc = true;
} else {
  getloc = await _location.requestService();
}
if (getloc) {
  currentLocation = await _location.getLocation();
}

Actually if you enter Yes it still never returns. The service can already be enabled, it's an additional service option when using mobile data rather than Wifi so that the device can use nearby wifi to increase location accuracy and this is not covered by the serviceEnabled call. The only way I can think to resolve this is call getLocation again after a timeout of X seconds.

Sounds related to #239.

@awhitford I believe it's unrelated, I'm having the problem in iOS

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.

Escrevi outra, #263 tamb茅m com o mesmo problema.

The latest update was published on Apr 10, 2019. Are these dependencies still supported and are they planned to include the latest updates and solutions? We have been waiting for this solution for many months and i can see that @nicowernli solved It on #267. Thanks.

Owner is AWOL, it's probably best if @nicowernli or someone else active re-publishes this on pub.

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.

Same problem here. If the user hits ALLOW to permissions, then the execution of the code never returns.

Hey ! Should be fixed with 2.5.0, please reopen if this still happens :) Thanks for your patience :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LondonJammo picture LondonJammo  路  4Comments

davcrash picture davcrash  路  3Comments

giudon010 picture giudon010  路  3Comments

Dorbmon picture Dorbmon  路  8Comments

zanecidan picture zanecidan  路  6Comments