Lyokone / flutterlocation

A Flutter plugin to easily handle realtime location in iOS and Android. Provides settings for optimizing performance or battery.
MIT License
1.1k stars 810 forks source link

Cannot set the location accuracy #691

Open ikarelin opened 2 years ago

ikarelin commented 2 years ago

Describe the bug I'm trying to set location accuracy to low when executing getLocation() to speed up receiving response. But my settings is not working

Expected behavior location accuracy is corresponding my settings

Tested on:

Other plugins:

Additional logs In log i'm always receiving different accuracy from 8 to 25 meters, regardless to my LocationAccuracy settings

Here is my code:

Future<void> updateLocationOnce() async {
    if (settingsShareLocation == false) return;

    bool permissionGranted = await checkPermissions();
    if (permissionGranted) {
      Location location = Location();
      LocationAccuracy locationAccuracy = LocationAccuracy.low;
      location.changeSettings(accuracy: locationAccuracy);
      log.wtf(
          'GLS - Executing location.getCurrentLocation in global location services');
      var locationData = await location.getLocation();
      log.wtf(
          'GLS - Current location accuracy (balanced) is ${locationData.accuracy}');
      log.wtf(
          'GLS - Completed executing location.getCurrentLocation in global location services');
      final coarseLocation = _coarseLocation(locationData);
      if (app.isInitializing) {
        lastKnownLocation = coarseLocation;
      }
      await updateCurrentLocation(coarseLocation, locationData);
      await api.rematchYouWatchManually();
    }
  }
stale[bot] commented 2 years ago

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.

avaiyakirtib commented 2 years ago

@ikarelin Hope you are doing well! I am facing an issue similar to yours. Did you get a chance to check back and resolved your problem? Your help would greatly help to move forward with this lib.