Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]: Improve Location Accuracy in Flutter App using Geolocator #1590

Open
4 of 8 tasks
akashs-gloify opened this issue Oct 11, 2024 · 10 comments
Open
4 of 8 tasks

Comments

@akashs-gloify
Copy link

akashs-gloify commented Oct 11, 2024

Please check the following before submitting a new issue.

Please select for which platform(s) you need help

  • Android
  • iOS
  • Linux
  • Web
  • macOS
  • Windows

Your question

We are developing a Flutter application that uses the Geolocator plugin for real-time location tracking. However, we are experiencing issues with the accuracy of the location data:

  • Inaccurate location points: The recorded location points often appear on nearby buildings rather than on the road, where the user is walking or driving.
  • Fluctuations when stationary: Even when standing still, the location coordinates tend to fluctuate, causing erratic movements in the plotted path.

Current Setup

  • Flutter Version: 3.24.3
  • Geolocator Version: 13.0.1
  • Platforms: Android & iOS
  • Accuracy Mode: LocationAccuracy.bestForNavigation
  • Distance Filter: Set to 15 meters

What We’ve Tried So Far

  1. Set Higher Accuracy Mode: Using LocationAccuracy.bestForNavigation for the highest precision.
  2. Distance Filter: Set to 15 meters to control the frequency of location updates.
  3. Checked Location Services: Ensured the location services are enabled.
  4. GPS Accuracy Optimization: Prompting users to enable "High Accuracy" mode on Android devices.

Despite these steps, the accuracy is still inconsistent.

Expected Behavior

  • Accurate location points along the road, with minimal deviation when the user is stationary.
  • Smoother paths when tracking movement.

Help Requested

We are looking for assistance in improving the location accuracy for both Android and iOS platforms. Any insights or advanced techniques would be greatly appreciated. Specifically, we are looking for help with:

  • Implementing techniques to reduce fluctuation while the user is stationary.
  • Improving real-time tracking precision while the user is moving (e.g., on the road).
  • Any advanced filtering techniques (e.g., Kalman Filter or sensor fusion) that can be applied to improve accuracy.

Additional Information

  • Device Used for Testing: Redmi, Samsung, iPhone etc.
  • Environment: Urban area with moderate building density.
  • Code Snippet: Here's a sample of how we're currently implementing Geolocator:
Position position = await Geolocator.getCurrentPosition(
  desiredAccuracy: LocationAccuracy.bestForNavigation
);
  • Map View Example: Here's a screenshot of the issue we're seeing with location plotting:
Screenshot 2024-10-11 at 8 33 12 AM

Any contributions or suggestions on how to resolve this issue would be greatly appreciated. Thanks in advance!

Version

13.0.1

@divyanshugarg36
Copy link

@akashs-gloify were you able to fix this?

I am facing the same problem, the location pointer jumps like crazy and my app highly depends upon the location accuracy...

@yymin1022
Copy link

Any idea for fixing?
I am facing same problem as you said.
It works fine with iOS Simulator on Xcode, but shows crazy jump within real iPhone device.

@cairogreco
Copy link

Same problem here, this didn't happen in previous versions.

@yymin1022
Copy link

@cairogreco as you said, any previous version has worked?
I wanna test that version
Which version has worked??

@divyanshugarg36
Copy link

Well if any of you figured out the version or found something else please make sure to drop something here please, Il'l do the same...

Ironically my app is highly dependent on this specific feature, if this ain't working the app ain't working...

@akashs-gloify
Copy link
Author

I haven’t found a complete solution yet, but I’ve observed the following:

Decreasing the intervalDuration (which is 5 seconds by default) increases fluctuations in location points. This is likely because, with more frequent updates, there’s less time for each GPS fix to stabilize, resulting in noticeable jumps in location, particularly when the user is stationary or moving slowly. Increasing the intervalDuration helps to smooth out these fluctuations, as GPS internally averages out signals over a longer period, providing more stable and accurate points that better match the user’s real-world movement.

I’m looking for a solution that achieves accurate location updates every second without these fluctuations. Any advice on optimizing this would be greatly appreciated!

@yymin1022
Copy link

For my experience, Android has normal and accurate data
But iOS just jumps like crazy...
AppleSettings does not have intervalDuration lol

@divyanshugarg36
Copy link

For people wondering what version is working better in terms of precision, I found 9.0.2 to be working better with mild jumps on both wifi and mobile network

Did someone else try anything?

@cairogreco
Copy link

For people wondering what version is working better in terms of precision, I found 9.0.2 to be working better with mild jumps on both wifi and mobile network

Did someone else try anything?

Gonna try this version.

@NibhaJ
Copy link

NibhaJ commented Nov 27, 2024

On iOS devices where the location data returned is very generic, and the precision is significantly lower compared to Android devices. This occurs despite using LocationAccuracy.high in the location settings. Facing this on multiple iOS devices. Any suggestion? this my setting

  _locationSettings = AppleSettings(
        accuracy: LocationAccuracy.high,
        activityType: ActivityType.fitness,
        distanceFilter: _distanceFilter,
        pauseLocationUpdatesAutomatically: true,
        // Only set to true if our app will be started up in the background.
        showBackgroundLocationIndicator: false,
      );

  geolocator: ^13.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants