How to get altitude in Android

google maps altitude
google earth altitude android
find my elevation above sea level
gps altitude
android location
how to measure altitude
how to calculate altitude from latitude and longitude
android gps altitude wrong

I use the Location class to get altitude, but it always returns 0.

Please tell me how to get altitude?


Initially I used location.getAltitude() and it always retuned 0.0 . Then I came across!topic/android-beginners/KNeLh905ip0 it helped me solve my problem. It works on actual real device.

private LocationProvider _locationProvider;
private LocationManager _locationManager;
   _locationManager = (LocationManager) mContext

    _locationProvider = _locationManager

     location = _locationManager.getLastKnownLocation 

            hasaltitude = location.hasAltitude();
            double altitude = location.getAltitude();
            System.out.println("HasAltitude" + hasaltitude+"-"+altitude);

The value of "altitude" is will be in meters.

See altitude and coordinates - Android, Use coordinates to find a place. If you know a place's coordinates, you can use them to find it on Google Earth. On your Android phone or tablet,  In order to find this information, you can use a third party app called GPS Test. This app fetches information from GPS satellites like your latitude, longitude, time, speed and the altitude. After installing the GPS Test app in your Android phone, you should enable the Location in the Android settings and change its setting to High Accuracy. Now you can launch the GPS Test app and wait for it to connect to the GPS satellites.

Altitude is typically only available with GPS provider. You can check with available location provider if the support altitude:


Get Altitude, Get the altitude and GPS coordinates using the #1 altitude app on Android Market. More accurate than GPS altitude! Ever wanted to know the height of a  On your Android phone or tablet, open the Google Earth app . Search for a place, or tap and drag the screen until you see the view you want. In the bottom right corner of the screen, you'll see the

You need to obtain the user Location :

The locationListener will give you a Location object, on which you can use the getAltitude() function.

How to Use Your Phone as a Barometer or Altimeter, How do I find the elevation above sea level of my house? Well if you have an android phone, the GPS on it can help you out to find your approximate altitude from the sea level. Although most android phones usually don’t come with a built-in feature to calculate altitude, but the Google play store has a lot of free apps to help you with finding out your current altitude.

With all the different methods to get location, while request a location for high accuracy it requires permission ACCESS_FINE_LOCATION

Location, magField = new GeomagneticField((float) location.getLatitude(), (float) location.​getLongitude(), (float) location.getAltitude(), System.currentTimeMillis()); The most important altitude measurement tool in your phone’s arsenal is the GNSS/GPS receiver. If your phone can find at least four satellites, with one directly overhead, you can usually get an altitude reading accurate to within 10 to 20 meters (35 to 70 feet).

android.location.Location.getAltitude java code examples, Here's how to measure altitude with your phone. and elevation apps for iPhone and Android, and honestly, their accuracy doesn't vary much. My Altitude is an altimeter app that can calculate your altitude – the height from the sea level, location, barometric pressure, and water boiling point. In order to get all of these measurements, the app uses your phone’s sensors and GPS.

How to Measure Your Altitude or Elevation with , Get the latitude, longitude, and altitude measurements from the GPS receiver on the Android device. You can also see a place’s altitude, or its height from the ground or sea. Search for a place, or adjust Google Earth until you see the view you want. In the bottom right corner, you'll see the

Measure GPS latitude, longitude, and altitude - Simulink, Find Altitude on Map. Determine the altitude (elevation) when a point is tapped/​clicked on a map. Find Location. Get the altitude and GPS coordinates using the #1 altitude app on Android Market. More accurate than GPS altitude! Ever wanted to know the height of a mountain you have been on? Get elevation data

  • are you trying it in real device or emulator...
  • I try this on emulator, OS version 1.6
  • I think in emulator it won't show value for that you have to check in real device....
  • Hello friend, can you share complete demo source code with me... I also want to know How to calculate ALTITUDE
  • I also tried this, when I use geo fix -121.45356 46.51119 4392 then it return true but altitude 0.0, but when I use geo nmea $GPRMC,081836,A,3751.65,S,14507.36,E,000.0,360.0,130998,011.3,E*62 then it return false.
  • yes i try it but it still return 0.0 value.I also try that in telnet console,geo fix -121.45356 46.51119 4392 and geo nmea $GPRMC,081836,A,3751.65,S,14507.36,E,000.0,360.0,130998,011.3,E*62