Distance calculation from my location to destination location in android

check the documentation on the google android dev page to see how to listen for position changes. http://developer.android.com/guide/topics/location/obtaining-user-location.html

you can use this function to determine the distance between the current (start) point and the target point.

 /**
 * using WSG84
 * using the Metric system
 */
public static float getDistance(double startLati, double startLongi, double goalLati, double goalLongi){
    float[] resultArray = new float[99];
    Location.distanceBetween(startLati, startLongi, goalLati, goalLongi, resultArray);
    return resultArray[0];
}

Leave a Comment