谷歌地图旅行模式:请求乘车

时间:2018-04-20 15:25:48

标签: android google-maps

是否可以更改旅行模式谷歌地图,以便在我的应用程序点击按钮时在Android上请求骑行标签?

enter image description here

我用过:

Intent intent = new Intent(Intent.ACTION_VIEW,
                Uri.parse("http://maps.google.com/maps?daddr="+    mLocation.latitude + ","+ mLocation.longitude +"&f=d&dirflg=r"));
startActivity(intent);

但参数dirflg仅限于:

dirflg=h - Switches on "Avoid Highways" route finding mode.
dirflg=t - Switches on "Avoid Tolls" route finding mode.
dirflg=r - Switches on "Public Transit" - only works in some areas.
dirflg=w - Switches to walking directions - still in beta.
dirflg=d - Switches to driving directions

1 个答案:

答案 0 :(得分:1)

似乎(请求乘车 - > ta X i)和:

dirflg=x - Switches on "request a ride tab" - only works in some areas.

你可以像这样的请求使用意图:

Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
        Uri.parse("http://maps.google.com/maps?saddr=-7.328306+112.715478&daddr=Jl.+Frontage+Ahmad+Yani+Siwalankerto&dirflg=x"));
startActivity(intent);

得到这样的结果:

Request a ride (taXi) tab

(在请求中将-7.328306+112.71547替换为mLocation.latitude + "+"+ mLocation.longitude for LatLng)