Set LocationEngine properties in android #510
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
I am currently developing a bike navigation app for a client (RadroutenPlaner Bayern). After publishing the first version of the app, we noticed that the location accuracy on Android was significantly poor when switching to a Following Mode. The location puck updates very slowly and with a noticeable delay, it felt like it was only using coarse location.
Upon investigating, I discovered that MapLibre Android uses the FusedLocationProvider by default, which only accepts a balanced location priority. Observing other major navigation apps like Komoot and Outdooractive via logcat, I found that they switch from the native fused provider to the GPS provider when the device enters Following Mode.
To address this issue, I added the ability to manipulate the native LocationEngine and LocationEngineRequest in flutter_maplibre. I introduced a property to the MaplibreMap widget called locationEnginePlatforms. This property currently allows you to adjust settings like interval, displacement, and priority (only on Android).
I don't have extensive experience with Java and Kotlin, so please let me know if there are any issues or if improvements are needed. Thanks for your feedback!