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

Platform interface: Updates documentation surrounding location accuracy on Android #1320

Conversation

JeroenWeener
Copy link
Contributor

On Android, location accuracy is interpreted in a rather unintuitive way. Users of the plugin get confused, resulting in reports coming in where users complain about not receiving positions. The problem sometimes lies in the fact that they use LocationAccuracy.lowest. While this accuracy option might suggest that location updates come in quicker, or at least at the same rate as higher accuracy options, this is not the case. Location accuracy on Android is mapped in the following way:

Location accuracy Android priority Description
lowest PRIORITY_PASSIVE Ensures that no extra power will be used to derive locations. This enforces that the request will act as a passive listener that will only receive "free" locations calculated on behalf of other clients, and no locations will be calculated on behalf of only this request.
low PRIORITY_LOW_POWER Requests a tradeoff that favors low power usage at the possible expense of location accuracy.
medium PRIORITY_BALANCED_POWER_ACCURACY Requests a tradeoff that is balanced between location accuracy and power usage.
high+ PRIORITY_HIGH_ACCURACY Requests a tradeoff that favors highly accurate locations at the possible expense of additional power usage.

This means that when using LocationAccuracy.lowest, the update frequency of the position stream becomes 0, unless another app asks for a location update.

In the future, we might want to separate the iOS and Android implementations in such a way that the API is not confusing to users in the way that it is now. This is quite the undertaking, however, and therefore we want to start by adding a note in the documentation. This PR adds the note in several locations where users may look during development.

Closes #1315.

Pre-launch Checklist

  • I made sure the project builds.
  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is does not need version changes.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • I rebased onto main.
  • I added new tests to check the change I am making, or this PR does not need tests.
  • I made sure all existing and new tests are passing.
  • I ran dart format . and committed any changes.
  • I ran flutter analyze and fixed any errors.

@codecov
Copy link

codecov bot commented Sep 5, 2023

Codecov Report

Patch has no changes to coverable lines.

Files Changed Coverage
...terface/lib/src/geolocator_platform_interface.dart ø

📢 Thoughts on this report? Let us know!.

@JeroenWeener JeroenWeener changed the title Updates documentation surrounding location accuracy on Android Platform interface: Updates documentation surrounding location accuracy on Android Sep 5, 2023
Copy link
Member

@mvanbeusekom mvanbeusekom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @JeroenWeener

@mvanbeusekom mvanbeusekom merged commit a28db33 into Baseflow:main Sep 6, 2023
3 checks passed
@JeroenWeener JeroenWeener deleted the enhancement/android_location_accuracy_documentation_pi branch September 22, 2023 12:17
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

Successfully merging this pull request may close these issues.

[Bug]: Timeout Exceeded for Retrieving Location on Emulator
2 participants