0

我搜索以将航路点添加到我的旅程中。

https://github.com/mapbox/mapbox-navigation-android/blob/master/app/src/main/java/com/mapbox/services/android/navigation/testapp/activity/WaypointNavigationActivity.java

在此示例中,下一个航点是在旅程结束时添加的。我想在同一旅程中添加所有积分。你有想法吗?

4

2 回答 2

2

您可以在使用 发出新的路线请求时添加航点NavigationRoute

在我们的文档https://www.mapbox.com/android-docs/navigation/overview/中,查看部分4. Requesting a route,您会找到如何执行此操作的示例。

NavigationRoute.Builder builder = NavigationRoute.builder()
  .accessToken(Mapbox.getAccessToken())
  .origin(origin)
  .destination(destination);

for (Position waypoint : waypoints) {
  builder.addWaypoint(waypoint);
}

builder.build();
于 2018-01-24T14:40:09.280 回答
-2

试试这个...使用谷歌地图

       StringBuilder sb_latlangdrive = new StringBuilder();
           for (int i = 0; i < arrayList.size(); i++) {
                String split[] = arrayList.get(i).split(",");
                sb_latlangdrive.append(split[0] + "," + split[1] + "|");
             }
             String split[] = arrayList.get(0).split(",");
             String split_endlocaiton[] = arrayList.get(arrayList.size() - 1).split(",");
             Uri gmmIntentUri = Uri.parse("https://www.google.com/maps/dir/?api=1&origin=" + split[0] + "," + split[1] + "&destination=" + split_endlocaiton[0] + "," + split_endlocaiton[1] + "&waypoints=" + sb_latlangdrive.toString() + "&travelmode=driving");
             Intent intent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
             intent.setPackage("com.google.android.apps.maps");
             try {
                   startActivity(intent);
             } catch (ActivityNotFoundException ex) {
               try {
                     Intent unrestrictedIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
                     startActivity(unrestrictedIntent);
                   } catch (ActivityNotFoundException innerEx) {
                      Toast.makeText(TrackingTesting.this, "Please install a maps application", Toast.LENGTH_LONG).show();
                 }
             }

有关参考,请参阅此处的文档

于 2018-01-24T10:21:07.807 回答