int LocationGet(float &lat, float &lng);


Gets the current location of the device.


Return Value


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





A floating point variable that will receive the current latitude of the device.  Positive values indicate northern latitudes; negative values indicate southern latitudes.



A floating point variable that will receive the current longitude of the device.  Positive values indicate eastern longitudes; negative values indicate western longitudes.        




LocationGet() populates two float variables with the current best available latitude and longitude of the device.  This function will use GPS on devices where it is available and performs location via IP address otherwise.


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


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




Available in DragonFireSDK 1.4 and later.




#include "DragonFireSDK.h"


int MyFont;

int LatitudeText;

int LongitudeText;

char TextBuffer[100];


void AppMain()



  // Begin monitoring location



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

  LatitudeText = TextAdd(10, 10, "Latitude:", MyFont);

  LongitudeText = TextAdd(10, 40, "Longitude:", MyFont);




void OnTimer()


  float lat;

  float lng;


  LocationGet(lat, lng);


  sprintf(TextBuffer, "Latitude: %f", lat);

  TextSetText(LatitudeText, TextBuffer);


  sprintf(TextBuffer, "Longitude: %f", lng);

  TextSetText(LongitudeText, TextBuffer);




void AppExit()