How to get barometric altitude in Android?

What are the data needed to calculate barometric altitude? How do I get them and then calculate the height?

Also, how accurate is barometric compared to GPS altitude? I tried GPS, but after searching the clock on the Internet, I can’t find a suitable Geoid library.

Please correct me if I get some kind of concept for a long time.

+3
source share
1 answer

You need to use a pressure sensor to measure pressure, then use SensorManager.getAltitude (float, float) to convert the pressure of the measure along with the reference pressure of the sea level to get the height.

A hard bit is what needs to be used as a reference pressure. This will change with the weather and will drift over time. Typically, you can perform some calibration to set these values ​​and possibly update them. It depends on your use case, which is the right solution.

If a correctly calibrated altitude based on pressure is much more accurate, then an altitude based on GPS, especially if you want to be interested, are altitude differences, not absolute heights. With a small number of filters on wet pressure values, you can easily detect by holding the phone at face level or the length of your arms over your head that you want to do with gps.

+8
source

All Articles