float LocationGetAltitude();


Gets the current altitude (in meters) of the device.


Return Value


Returns a non-zero value if the call was successful, zero otherwise.




LocationGetAltitude() returns the current altitude in meters relative to sea level.


Altitude data is not available on all devices, as it requires a GPS radio.


Windows Simulator NOTE: To provide values for the Windows Simulator, be sure to edit C:\DragonFireSDK\DragonFireSDK.ini and modify the value for Altitude in the Location section.


NOTE: It is recommended to call LocationMonitorLocation() prior to calling LocationGetAltitude().  This gives the device time to begin receiving more and more accurate location data prior to getting location data.  Subsequent calls to LocationGetAltitude() may become more accurate over time as the device pinpoints your location.




Available in DragonFireSDK 1.4 and later on devices with GPS.




#include "DragonFireSDK.h"


int MyFont;

int AltitudeText;

char TextBuffer[100];


void AppMain()



  // Begin monitoring location



  MyFont = FontAdd("Helvetica", "Regular", 24, 0x00FF00);

  AltitudeText = TextAdd(10, 10, "Altitude:", MyFont);




void OnTimer()


  float altitude;


  altitude = LocationGetAltitude();


  sprintf(TextBuffer, "Altitude: %fm", altitude);

  TextSetText(AltitudeText, TextBuffer);




void AppExit()