Skip to content

Altitude reported incorrectly on Android. iPhone is correct. #831

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

Closed
nicolasjon opened this issue Sep 3, 2021 · 6 comments
Closed

Altitude reported incorrectly on Android. iPhone is correct. #831

nicolasjon opened this issue Sep 3, 2021 · 6 comments
Labels
platform: android Issue is related to the Android platform. type: enhancement New feature or request

Comments

@nicolasjon
Copy link

🐛 Bug Report

Expected behavior

Altitude to be reported the same or at least very close(!) for Android and iPhone.

Reproduction steps

Loaded app on to Android and iPhone tested app in several different places on both devices simultaneously, giving GPS plenty of time to settle.
The iPhone gave a "correct" altitude result verified by local maps. The Android phone was consistently 50 or more metres high. Locations very close as expected, the two phones where side by side.
Android and iPhone screen shots attached.

Configuration

Android Nexus 5 (Android 10)
iPhone 7 (iOS 14.7.1)

Version:
geolocator: 7.6.0

Platform:

  • [ x] 📱 iOS
  • [ x] 🤖 Android

altitudeAndroid
altitudeiPhone

@nicolasjon
Copy link
Author

Have not got to the geolocation Java code yet - taking a while to find. Although it appears geolocation is using this method
https://developer.android.com/reference/android/location/Location#getAltitude()
Key point is this - Get the altitude if available, in meters above the WGS 84 reference ellipsoid.
Thus the Altitude returned is relative to the WGS 84 datum - not - sea level.

SO describes one solution using The NMEA strings directly from the GPS
https://stackoverflow.com/questions/9361870/android-how-to-get-accurate-altitude
This is my current research, and will likely evolve, hopefully it is of some help.

@nicolasjon
Copy link
Author

Just seen this Geolocation PR -
Add NMEA receiving feature (null safety update) #819
This would enable the Altitude relative to sea level to be directly collected from the NMEA string as outlined by the previous SO post.

@nicolasjon
Copy link
Author

Any thoughts on this? Thanks!

@nicolasjon
Copy link
Author

I understand that folks are busy. If this is being worked on and may emerge in the future, or if it never will be? Any information would be great, as this would be a very useful feature. Thanks.

@mvanbeusekom
Copy link
Member

Hi @nicolasjon,

Sorry for not replying sooner. I am indeed working on fitting in the NMEA solution, however I would like to do it in a way so that we don't get a lot of no-operation methods on iOS, macOS and the web.

I am updating the architecture of the geolocator plugin to allow having additional platform specific classes available which could contain functions such as NMEA which are only supported on that particular platform. So in other words this will become available in the near future, however not sure on an exact E.T.A. yet.

@mvanbeusekom mvanbeusekom added platform: android Issue is related to the Android platform. type: enhancement New feature or request labels Oct 8, 2021
@nicolasjon
Copy link
Author

I understand. Thank you very much for the update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: android Issue is related to the Android platform. type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants