我找到了另一种使用 SensorManager 获取高度的方法,但它需要两个参数。
public static float getAltitude (float p0, float p)
Computes the Altitude in meters from the atmospheric pressure and the pressure at sea level.
p0 pressure at sea level
p atmospheric pressure
您能通过实际示例/代码片段教我们如何使用它。
UPDATES1
我找到了 Web 服务提供商 (WSP) url 来获取p0 pressure at sea level
. 我已成功获取值但不理解返回的值。
WSP 网址:http ://avdata.geekpilot.net/
这是东京国际机场的示例输出(http://avdata.geekpilot.net/weather/HND)
<weather>
<ident>RJTT</ident>
<error/>
<metar>
2011/09/22 08:00
RJTT 220800Z 04019KT 9999 -SHRA FEW012 BKN025 BKN040 21/18 Q1000 NOSIG
</metar>
<taf>
2011/09/22 04:12
TAF
AMD TAF
AMD RJTT 220409Z 2204/2306 08016KT 9999 FEW030 SCT050
BECMG 2204/2206 05014KT
TEMPO 2207/2209 36018G30KT SHRA
BECMG 2303/2306 10008KT
</taf>
</weather>