2

I am using Google new location Api in my app like this

private static final LocationRequest REQUEST = LocationRequest.create().setInterval(2000).setFastestInterval(1000)
        .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);

private LocationListener mLocationListener = new LocationListener() {

    @Override
    public void onLocationChanged(final Location location) {
        if(location.hasAltitude()){
            Log.e(TAG, "Altitude " + location.getAltitude());
        }else{
            Log.e(TAG, "Location does not have altitude");
        }
    }
};

but location.hasAltitude() always false, I have tested it on real device and in open area, but it does not have altitude anywhere, but if I am using the old location Listener, its working fine,

4

1 回答 1

2

从 3.1.36 版本的 API 融合位置提供程序开始,总是在那里返回 false(至少在我打开 GPS 时),所以你可能想要坚持使用LocationManagerGPS 提供程序。

希望他们能在未来的版本中改进融合算法。

于 2013-06-03T19:05:28.227 回答