简体   繁体   中英

How to get total travel time between two location in google map?

I implement to get distance between two location in google map in android but i have not idea how to get travel time for this two location ? I refer many example but i can not understand. Give me example

You can get travel time from [Google Direction API] -

Link: https://developers.google.com/maps/documentation/directions/start#sample-request

Provide your origin & destination in the URL and you'll get a JSON Response.

You can then find travel time in the response as:

routes(JSONArray) -> legs(JSONArray) -> duration(JSONObject)

Reference Link: https://developers.google.com/maps/documentation/directions/intro#DirectionsRequests

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM