diff --git a/api/current.xml b/api/current.xml index cc007cc0e8480..1c51f06dff7fb 100644 --- a/api/current.xml +++ b/api/current.xml @@ -77870,6 +77870,21 @@ deprecated="not deprecated" visibility="public" > + + + + + + + + + * Typically the atmospheric pressure is read from a + * {@link Sensor#TYPE_PRESSURE} sensor. The pressure at sea level must be + * known, usually it can be retrieved from airport databases in the + * vicinity. + *

+ * + * @param p0 pressure at sea level + * @param p atmospheric pressure + * @return Altitude in meters + */ + public static float getAltitude(float p0, float p) { + final float coef = 1.0f / 5.255f; + return 44330.0f * (1.0f - (float)Math.pow(p/p0, coef)); + } + + + /** * {@hide} */ public void onRotationChanged(int rotation) {