This will be about the GPS section of the LocationSensor.

First, some notes about the GPS.

The LocationSensor.LocationChanged changes based on the address, not Lat/Lon, so if you walk around at the same address this block will not fire.

The GPS itself appears to be on some kind of timer, after it starts and settles down it will go to sleep about 60 seconds, wake for about 10 seconds and then go back to sleep.  During the times it's asleep the LocationChanged block will still fire (based on cell towers I think) and this will sometimes also start the GPS again. A work around for this is to start another GPS App that will continue to run in the background and your App can feed off of it.

You can't get NMEA data into your App from the LocationSensor.

The Source File: http://sites/

The Math For Distance.

Here you call
where MarkLat/MarkLon is the location away from the phone and it will return the distance from it to the phone.

In this case it's in Yards, Why? Because the Var. EarthRadiusYards is in yards.
If you want the output to be in miles just use the earth's radius in miles, etc.. some numbers.
Yards = 6967410.3237
Miles = 3,959
Kilometers = 6,371 km


You would also want to know the bearing from your phone to some Lat/Lon, so here's the math for it, it uses the great circle math.
The returned value is in degrees, as in 0.00 = North and 180.00 = South

Edward Filkins,
Dec 9, 2010, 6:12 PM