My code requires to find the distance between two Tablets and the direction of second Tablet with reference to the first one. Both the Tabs update their location every 10 seconds.
But the distance as well as the initial and final bearing values vary as the locations update.
Location.distanceBetween(destLatitude, destLongitude, sourceLatitude, sourceLongitude, result);
float calc_distance = result[0];
float InitBearing = result[1];
if(InitBearing<0)
{
InitBearing = 360-Math.abs(InitBearing);
}
float FinalBearing = result[2];
if(FinalBearing<0)
{
FinalBearing = 360-Math.abs(FinalBearing);
}