Android Google Directions Service usable natively? with wrapper framework? Public transit/biking directions available?(Android Google Directions Service 可以原生使用吗?与包装框架?公共交通/自行车路线可用吗?)
问题描述
关于 Android 和 Google 路线服务的一些问题:
Some questions about Android and Google Directions Service:
Android 上是否有使用 Google 的 Directions Service 的本地方式,或者是否有任何不错的 Wrapper 框架?我想检索从 A 到 B 所需的时间,并可能在表格和/或地图中显示路线.
Is there a native way on Android to use the Directions Service from Google or are there any nice Wrapper Frameworks? I would like to retrieve the time needed to get from A to B and maybe show the route in a table and/or map.
据我所知,只能检索步行"和驾驶"的路线.有没有办法(可能不是来自谷歌)也可以为公共交通工具或骑自行车"获取此信息?
As far as I know directions can only be retrieved for "walking" and "driving". Is there a way (maybe not from google) to get this Information also for public transports or "biking" ?
推荐答案
我不知道这是否是你想要的,但你可以像这样启动一个意图:
I don't know exactly if this is what you want, but you could fire up an intent like this:
String url = "http://maps.google.com/maps?saddr=some+address&daddr=another+Address"
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(url));
要获取骑行路线,请在网址中添加&dirflg=b".公共交通添加dirflg=r".
To get biking directions add "&dirflg=b" to the url. For public transport add "dirflg=r".
这将在谷歌地图应用程序中显示路线.如果您想在地图视图中的应用中获取此信息,请参阅 github 上的此代码.您可以破解代码来添加自行车和公共交通功能.
This will display the route in the google Maps app. If you want to get this in your app inside a mapview, please see this code at github. You could hack into the code to add biking and public transport functionality.
希望这能有所帮助.
这篇关于Android Google Directions Service 可以原生使用吗?与包装框架?公共交通/自行车路线可用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Android Google Directions Service 可以原生使用吗?与包装框架?公共交通/自行车路线可用吗?


- 类似于 Mail.app 的 iPad 模态视图控制器? 2022-01-01
- 如何在 iPhone 模拟器中重置 NSUserDefaults 数据? 2022-01-01
- 在 Iphone SDK 的导航栏上添加多个按钮 2022-01-01
- UITextView 内容插图 2022-01-01
- 使用自动布局向 UIScrollView 添加动态大小的视图 2022-01-01
- GPS状态的广播接收器? 2022-01-01
- 网上有没有好的 UIScrollView 教程? 2022-01-01
- Xcode 7.3 中带有 UILabel 的 UIStackView 2022-01-01
- SetOnItemSelectedListener上的微调程序错误 2022-01-01
- URL编码Swift iOS 2022-01-01