![](/img/trans.png)
[英]How can I get travel time between two location on google map in android?
[英]How to get total travel time between two location in google map?
我實現了要在android中的Google地圖中獲取兩個位置之間的距離,但是我不知道如何獲取這兩個位置的旅行時間? 我提到很多例子,但我聽不懂。 給我舉個例子
您可以從[Google Direction API]中獲取旅行時間-
鏈接: https : //developers.google.com/maps/documentation/directions/start#sample-request
在URL中提供您的出發地和目的地,您將獲得JSON響應。
然后,您可以在響應中找到旅行時間,如下所示:
路線(JSONArray)->腿(JSONArray)->持續時間(JSONObject)
參考鏈接: https : //developers.google.com/maps/documentation/directions/intro#DirectionsRequests
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.