Android Google Directions Service 可以原生使用吗?与包装框架?公共交通/自行车路线可用吗? [英] Android Google Directions Service usable natively? with wrapper framework? Public transit/biking directions available?

查看:19
本文介绍了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 可以原生使用吗?与包装框架?公共交通/自行车路线可用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆