Android Question GPS Vs Proximity

DeviousD

Member
Licensed User
Hi

I have a need to determine the location of other devices in the vicinity on the current device.

I'm using HTTP push to send current device GPS coords to a mysql database with PHP backend.

Using this PHP function i can get the distance away from me...

function haversineGreatCircleDistance(
$latitudeFrom, $longitudeFrom, $latitudeTo, $longitudeTo, $earthMeanRadius = 6371)
{
$deltaLatitude = deg2rad($latitudeTo - $latitudeFrom);
$deltaLongitude = deg2rad($longitudeTo - $longitudeFrom);
$a = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) +
cos(deg2rad($latitudeFrom)) * cos(deg2rad(latitudeTo)) *
sin($deltaLongitude / 2) * sin($deltaLongitude / 2);
$c = 2 * atan2(sqrt($a), sqrt(1-$a));
return $earthMeanRadius * $c;
}

I can fetch devices that are within a certain distance from my PHP dataservice... but...

How would i go about getting the bearing of where other devices are in relation to me and then plot them?

I have used the GPS samples for Other projects and this works to a degree, Not sure the proximity samples will work as I'm not sure how to bring these elements together.

Any suggestions on how to tackle this?
 
Top