gpt4 book ai didi

android - Google Maps Intent - 避开高速公路和收费站? (安卓)

转载 作者:搜寻专家 更新时间:2023-11-01 08:58:07 25 4
gpt4 key购买 nike

我到处寻找解决方案,但找不到。基本上我正在尝试启动谷歌地图应用程序以获取某个地方的行车路线。如何添加标志以避开高速公路和收费站?我试过将以下内容附加到我的网址,但无济于事。对于高速公路:

&dirflag=h
&avoid=highways

它会忽略我传递给 Intent 的任何参数。我可以对 google map 应用程序进行 putextra 操作吗?

这是我的网址:

String url = "http://maps.google.com/maps?saddr=" + mylatitude + "," + 
mylongitude + "&daddr=" +
anotherlat + "," + anotherlong;
if(somethingischecked) {
url += AVOID_HIGHWAYS_FLAG?
}
Intent toMaps = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(url));

最佳答案

您需要使用“dirflg”参数,而不是“dirflag”。

dirflg=h, Avoid highways.
dirflg=t, Avoid tolls.
dirflg=r, Public transit but it only works in some areas.
dirflg=w, Walking but still in beta.
dirflg=b, Biking but only works in some areas and still in beta.

例如,如果你想避开高速公路:

String url = "http://maps.google.com/maps?saddr=" + lat_A+ "," + lng_B + "&daddr=" + lat_B + "," + lng_B + "&dirflg=h";

如果您想同时避开高速公路和收费站:

String url = "http://maps.google.com/maps?saddr=" + lat_A+ "," + lng_B + "&daddr=" + lat_B + "," + lng_B + "&dirflg=h,t";

关于android - Google Maps Intent - 避开高速公路和收费站? (安卓),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17386853/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com