float LocationDistanceFrom(float lat, float lng);

 

Gets the distance (in meters) from the most recent known device location to the coordinates passed in.

 

Return Value

 

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

 

Parameters

 

lat

The latitude of the point to which you wish to calculate distance.

 

lng

The longitude of the point to which you wish to calculate distance.

 

Remarks

 

LocationDistanceFrom() returns the distance (in meters) that the most recent known location of the device is from the coordinates specified.

 

NOTE: this function is effective on the device only.

 

Availability

 

Available in DragonFireSDK 1.4 and later.

 

Example

 

#include "DragonFireSDK.h"

 

int MyFont;

int DistanceToAppleText;

char TextBuffer[100];

 

void AppMain()

{

  LandscapeMode();

  // Begin monitoring location

  LocationMonitorLocation(1);

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

  DistanceToAppleText = TextAdd(10, 10, "Distance to Cupertino:", MyFont);

}

 

//===============================================

void OnTimer()

{

  float dist;

  dist = LocationDistanceFrom(37.33294444f, -122.0325556f);

 

  sprintf(TextBuffer, "Distance to Cupertino: %fm", dist);

  TextSetText(DistanceToAppleText, TextBuffer);

}

 

//===============================================

void AppExit()

{

 

}