flutter-geolocator
flutter-geolocator copied to clipboard
MSL Altitude on Android
:sparkles: What kind of change does this PR introduce? (Bug fix, feature, docs update...)
Feature
:arrow_heading_down: What is the current behaviour?
Currently android reports location altitude as the value received from the GPS directly.
:new: What is the new behaviour (if this is a feature change)?
There are some use cases where MSL altitude is desired instead. NMEA messages can used in these scenarios to get the MSL altitude for the location instead of the normal geoid altitude. This feature adds a new Android setting requesting the platform to report altitude as MSL instead which will then register and NMEA client on the Android side if available and use the NMEA messages instead as the altitude values for position updates.
:boom: Does this PR introduce a breaking change?
No, the change is backwards compatible with existing clients.
:bug: Recommendations for testing
Toggle the Android setting to use MSL or not to use MSL in the example app and observe the difference in altitude being reported
:memo: Links to relevant issues/docs
https://github.com/Baseflow/flutter-geolocator/issues/987
:thinking: Checklist before submitting
- [x] I made sure all projects build.
- [x] I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
- [x] I updated CHANGELOG.md to add a description of the change.
- [x] I followed the style guide lines (code style guide).
- [x] I updated the relevant documentation.
- [x] I rebased onto current
master.
Codecov Report
Merging #1057 (3dc507e) into main (8aada97) will increase coverage by
17.10%. The diff coverage is100.00%.
@@ Coverage Diff @@
## main #1057 +/- ##
===========================================
+ Coverage 81.19% 98.30% +17.10%
===========================================
Files 3 3
Lines 117 118 +1
===========================================
+ Hits 95 116 +21
+ Misses 22 2 -20
| Impacted Files | Coverage Δ | |
|---|---|---|
| ...ocator_android/lib/src/types/android_settings.dart | 100.00% <100.00%> (+100.00%) |
:arrow_up: |
| ...tor_android/lib/src/types/foreground_settings.dart | 100.00% <0.00%> (+92.30%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 8aada97...3dc507e. Read the comment docs.
@mvanbeusekom I know there are a few open PR's for NMEA but I figured I'd make this one to get MSL reporting in without changing any platform interfaces. This also allows Geolocator to mimic the Location package in behaviour which might be beneficial considering many peeps are migrating from that due to it's lack of support.
@mvanbeusekom did you get a change to look at the PR and the proposed change yet?
@mvanbeusekom anything else that needs to be done?
Hi @Wackymax, I am on a two week holiday now but will have a look at it when I get back.
Oh nice! Enjoy the holiday 😃
On 01 Aug 2022, at 17:47, Maurits van Beusekom @.***> wrote:
Hi @Wackymax, I am on a two week holiday now but will have a look at it when I get back.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.
Hi @Wackymax,
I have tried this feature on the new Geolocator release (9.0.2) on Android 10 (physical device).
I use it like this:
Geolocator.getPositionStream(locationSettings: new AndroidSettings(accuracy: LocationAccuracy.best, distanceFilter: 2, useMSLAltitude: true))
It doesn't matter if I set useMSLAltitude to true or false. Altitude in both cases are the same, too high about 40 meters at my locaction.
Please also check Geolocator.getCurrentPosition(). There is an AndroidSettings object without flag useMSLAltitude. I don't know if it also matters. Thank you.