traccar / traccar-client-android

Traccar Client for Android
https://www.traccar.org/client
Apache License 2.0
665 stars 736 forks source link

Wrong altitude value of exactly 40 metres #452

Closed mvetrini-fc closed 1 year ago

mvetrini-fc commented 1 year ago

The Android app sends an altitude value 40 metres higher than the actual value (e.g. 186.25 instead of 146.25). I have tested with several Android devices (Samsung, Xiaomi, etc.) and they all show this error. The iOS app, on the other hand, sends the correct value. To be sure that the problem was solely with the Android app (and therefore not with Traccar Server or Traccar Web), I viewed the values contained in the package via my Node.js server and the error was already present in it.

tananaev commented 1 year ago

How did you check that the problem is with the app and not your phone?

mvetrini-fc commented 1 year ago

I think I have discovered the problem. In Italy (where I am currently located) the geoid is below the ellipsoid by about 40-50 m (hence the value). Apple devices return the altitude above mean sea level, Android on the other hand returns the altitude above the World Geodetic System 1984 and can later be converted (https://developer.android.com/reference/kotlin/android/location/altitude/package-summary). Wouldn't it be better to standardise both apps so that they return the same values?

tananaev commented 1 year ago

We use the APIs provided by each platform. We don't calculate altitude ourselves.

mvetrini-fc commented 1 year ago

For the record, what I have linked is an Android API, you don't have to calculate anything. We are talking about adding a line of code. By doing so, you don't even give the server a way to know which OS sent the package, and I can't modify it accordingly.

tananaev commented 1 year ago

But then someone else would be confused why the values changed between versions.

mvetrini-fc commented 1 year ago

One could add a value to the package that specifies the OS from which it was sent or add a checkbox on the app that is unchecked by default to be able to convert altitude to MSL so that current usage is not compromised.

tananaev commented 1 year ago

We should be able to get the OS from the header. So just the backend change is required.