flutterlocation icon indicating copy to clipboard operation
flutterlocation copied to clipboard

[bug] getLocation function never completes if `Google Location Accuracy` is diabled

Open iamdipanshusingh opened this issue 2 years ago • 4 comments

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

  1. Search for location in Phone Settings
  2. Look for Google Location Accuracy and disable it
  3. Call Location.instance.getLocation() nothing happens

Tested on:

  • Android 11, real device

iamdipanshusingh avatar Nov 24 '22 12:11 iamdipanshusingh

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

bgmf avatar Apr 26 '23 13:04 bgmf

same issue here, any workaround ?

GaelleJoubert avatar Jun 29 '23 08:06 GaelleJoubert

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 !

GaelleJoubert avatar Jun 29 '23 09:06 GaelleJoubert