[英]getting distance between two locations(road distance) in android not working on real device
[英]Measure the distance between two locations by road
如何在Android應用程序中通過道路測量兩個位置之間的距離? 我編寫了用於測量直線距離的代碼,但是我需要通過道路獲得最短距離的代碼。 我應該為此更改什么代碼?
public double updateDistance(Location location) {
float results[] = new float[3];
Location.distanceBetween(location.getLatitude(),
location.getLongitude(), mLatitude, mLongitude, results);
distance = results[0];
return distance;
}
請改用Google Maps API
https://developers.google.com/maps/documentation/distance-matrix/intro?hl=zh-CN
你也可以看到這個
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.