flutterlocation
flutterlocation copied to clipboard
[bug] getLocation function never completes if `Google Location Accuracy` is diabled
Description
getLocation
function never completes if Google Location Accuracy
is disabled. Nothing happens irrespective of what the user selects in location request dialog.
Expected behavior
It should either return the LocationData
or throw a relevant error
Steps To Reproduce This is only reproducible in android
- Search for location in Phone Settings
- Look for
Google Location Accuracy
and disable it - Call
Location.instance.getLocation()
nothing happens
Tested on:
- Android 11, real device
In the current stable version the Google dialog requesting to enable it - allowing us to decline it - pops up, but is repeatedle called, rendering the app useless, since we can only say "yes" to satisfy the package. /sadface
same issue here, any workaround ?
I have also noticed another anoying behavior. about the onLocationChanged stream.
Location _location = Location();
_location.onLocationChanged.listen((LocationData currentLocation) {
print("new loc : $currentLocation");
});
Case 1 : Google Location Accuracy activated : everything works as expected
Case 2 : Google Location Accuracy desactivated : The callback in the listener is never called, we don't have acess to locations updates
Case 3 : Google Location Accuracy activated, then we start the listener, and then we deactivate Google Location Accuracy. Surpisingly, it still works ! So it means than the issue is really at the start of the function, but that it is still possible to get Location positions, when Google Location Accuracy is tuned off.
That would be great to have a fix !