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

Set LocationEngine properties in android #510

Merged
merged 7 commits into from
Feb 18, 2025

Conversation

danieljosua1
Copy link
Contributor

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!

mweller83 pushed a commit to mweller83/flutter-maplibre-gl that referenced this pull request Jan 15, 2025
@CEichmueller
Copy link

CEichmueller commented Feb 18, 2025

@josxha and @m0nac0 any updates on this one?

@josxha
Copy link
Collaborator

josxha commented Feb 18, 2025

@Letalus feel free to kick things off by testing this pull request.👍

@CEichmueller
Copy link

@josxha thanks for your answer. I tested it (plus used it within my production app already) and it is working as expected. Do you need any further specific testing?

Copy link
Collaborator

@josxha josxha left a comment

Choose a reason for hiding this comment

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

Sounds good, thanks for testing @Letalus.
I already looked though the changes, looking good. 👍
Thanks @danieljosua1 for your contribution and sorry for the long wait.

@josxha
Copy link
Collaborator

josxha commented Feb 18, 2025

The CI will probably fail on the main branch because of Flutter 3.29 / Dart 3.7 but let's merge.

@josxha josxha merged commit 450a54e into maplibre:main Feb 18, 2025
9 checks passed
tetrochel added a commit to tetrochel/flutter-maplibre-gl that referenced this pull request Feb 18, 2025
Set LocationEngine properties in android (maplibre#510)
@CEichmueller
Copy link

@josxha perfect thanks again. I have one more question. Currently we are using this package for 2 different apps. Therefore this package is highly important for us. My question is, how can I and Daniel get read/write access, so we can also work on the different current PRs and submit more PRs (which we are currently working on)

@josxha
Copy link
Collaborator

josxha commented Feb 18, 2025

Best would be to get in touch with Ramya via Slack and join the repository as outside collaborators (just like me).

gabbopalma pushed a commit to gabbopalma/flutter-maplibre-gl that referenced this pull request Feb 20, 2025
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!
@josxha josxha added this to the v0.21.0 milestone Feb 24, 2025
remax21 pushed a commit to viamichelin/flutter-maplibre-gl that referenced this pull request Feb 24, 2025
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!
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.

3 participants