首页 > 解决方案 > 如何使用意图打开谷歌地图导航并将折线作为参数而不是开始和结束位置

问题描述

我有需要通过已经定义的路线导航的用例,我有一条折线或一组路线的纬度,但是在 URI 中用于谷歌地图意图我找不到通过折线纬度进行导航的方法,请检查并更新是否有任何可能的解决方案或破解

String uri = "https://www.google.com/maps/dir/?api=1&destination=" + dest + "&source=" + source + "&travelmode=driving&dir_action=navigate";
    List<LatLng> stopOvers = getAllStopOvers();
    if(stopOvers.size() > 2){
        StringBuilder wayPointsString = new StringBuilder("&waypoints=");
        for (LatLng stopOver : stopOvers) {
            wayPointsString.append(stopOver.latitude);
            wayPointsString.append(",");
            wayPointsString.append(stopOver.longitude);
            wayPointsString.append("|");
        }
        uri = uri + wayPointsString.toString();
    }

标签: google-mapsandroid-intentgoogle-maps-android-api-2

解决方案


推荐阅读