android - 谷歌地图自行车路线 Intent

标签 android google-maps directions

当使用 Intent 通过 Google map 方向启动导航时,有没有办法指定您想要步行/骑自行车的路线?

最佳答案

参见https://developers.google.com/maps/documentation/directions/

By changing the mode and avoid parameters, the initial request can be modified to return directions for a scenic bicycle journey that avoids major highways.

https://maps.googleapis.com/maps/api/directions/json?origin=Toronto&destination=Montreal&avoid=highways&mode=bicycling&key=API_KEY

Travel Modes

When you calculate directions, you may specify the transportation mode to use. By default, directions are calculated as driving directions. The following travel modes are supported:

driving (default) indicates standard driving directions using the road network. walking requests walking directions via pedestrian paths & sidewalks (where available). bicycling requests bicycling directions via bicycle paths & preferred streets (where available). transit requests directions via public transit routes (where available). If you set the mode to transit, you can optionally specify either a departure_time or an arrival_time. If neither time is specified, the departure_time defaults to now (that is, the departure time defaults to the current time). You can also optionally include a transit_mode and/or a transit_routing_preference.

您可以像这样使用它(代码 fragment 来自https://stackoverflow.com/a/2663565/1843331)

Intent intent = new Intent(android.content.Intent.ACTION_VIEW, 
    Uri.parse("http://maps.google.com/maps?saddr=20.344,34.34&daddr=20.5666,45.345"));
startActivity(intent);

关于android - 谷歌地图自行车路线 Intent ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28560029/

相关文章:

android - 从父 View 中删除 View 与隐藏 View

Android for work - 如何检查我的应用程序是否在工作配置文件中运行?

android - 谷歌地图崩溃 null LatLng

directions - Google Directions API

android - Paypal 整合 (MECL)

java - 回收器 View 不显示 fragment 中的项目

java - Android Google Maps Library 在 General Mobile Discovery 上卡住

Android - 将相机移动到 Google map 上的硬编码坐标因手机而异?只有纬度?

python - 根据字符串所在位置对 map 上的字符串元素进行计数,并用计数填充网格

iOS MapKit 通过道路连接 map 上的多个点