问题描述
我目前正在开发一个将启动导航意图的应用程序.我知道这不是官方 API,但它可以按照我想要的方式完美运行.
I'm currently developing an application that will launch a navigation intent. I know that this isn't an official API, but it works perfectly the way I want it to.
我允许用户选择驾车、步行和公交车导航到某个位置.直接启动到 Google 地图导航的意图如下所示:
I allow the user to select driving, walking, and bus navigation to a location. The intent to launch directly into Google Maps Navigation looks like this:
google.navigation:ll=
+ 纬度和经度,然后 + &mode=
然后是您的交通方式.例如,使用步行路线导航到某个区域:
google.navigation:ll=
+ a latitude and longitude, then + &mode=
then your mode of transportation. For example, to navigate using walking directions to a certain area:
google.navigation:ll=blah,blah&mode=w
默认驾驶是&mode=d
,骑自行车是&mode=b
,但我不知道公共汽车(公共交通).
Driving is default, or &mode=d
, and biking is &mode=b
, but I can't figure out bus (public transit).
以前有人做过吗?
谢谢!
到目前为止,我发现 mode=public
提供自行车路线,mode=transit
提供驾驶,令人沮丧的是,mode=bus
还返回自行车路线.
So far, I've found that mode=public
gives bike directions, mode=transit
gives driving, frustratingly, mode=bus
also returns bike directions.
更多:mode=train
也提供驾驶功能...必须有办法做到这一点...
More: mode=train
also gives driving... There's GOT to be a way to do this...
另一个我刚刚意识到我很确定它不存在,因为在尝试了术语之后,我意识到我应该启动一个带有巴士搜索的 Google 地图意图,但是有人知道怎么做吗?
Another I realized just now that I'm pretty sure that it doesn't exist, because after experimenting with terms I realized that I should instead launch a Google Maps intent with a bus search, but does anyone know how to do this?
推荐答案
经过一番猜测和四处寻找,我决定直接启动巴士导航是不可能的,因为这将涉及为人选择一辆巴士骑,这是没有意义的.
After a bunch of guessing and hunting around, I have decided that it is impossible to launch directly to bus navigation, because that would involve CHOOSING a bus for the person to ride, which wouldn't make sense.
相反,您可以将它们启动到谷歌地图搜索到目的地,感谢您这个答案类似的问题:
Instead, you can launch them to a Google Maps search to the destination like so, thank you to this answer to a similar question:
"http://maps.google.com/maps?daddr=lat,long&dirflg=r"
使用 &dirflag
指定公共交通.(为什么r"我不知道...)
With the &dirflag
specifying public transit. (Why the "r" I have no idea...)
这篇关于Android google.navigation 意图模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!