0

How i can to get travel duration in MINS from point A to B in Google maps, below i attach my code fragment:

Location locationB = new Location("point B");

locationB.setLatitude(location.getLatitude());
locationB.setLongitude(location.getLongitude());

distance = locationA.distanceTo(locationB);

double kms = distance / 1000 ;
String distanceKm = new DecimalFormat("#.0").format(kms);

Log.v("log", "distance " + distance);
tv3.setText(distanceKm + "Kms");

Thnks for any help

Matteo
  • 19
  • 7

1 Answers1

0

Refer below link google provide direction api it give all the information about source to destination place. read this all things you getting your question solution. https://developers.google.com/maps/documentation/directions/start

  • you can also refer this link for manual find distance https://stackoverflow.com/questions/14394366/find-distance-between-two-points-on-map-using-google-map-api-v2 –  Jul 02 '18 at 05:58