gpt4 book ai didi

java - 显示 map 框的导航 View ,方向单位为公里/分钟而不是英里/英尺

转载 作者:行者123 更新时间:2023-12-01 06:25:08 24 4
gpt4 key购买 nike

如何以方向单位公里/分钟显示mapboxnavigationview而不是英里/英尺

 String awsPoolId = null;
boolean simulateRoute = false;

Log.e("=origin==", "" + origin);
Log.e("=desti==", "" + destination);

// Call this method with Context from within an Activity
NavigationLauncher.startNavigation(GotoPickup.this, origin, destination, awsPoolId, simulateRoute);

最佳答案

您必须设置所需的类型 (METRIC)。我从 Mapbox 计算路线(注意语音指令)并将其传递给 NavigationLauncher:

NavigationRoute.builder()
.voiceUnits(DirectionsCriteria.METRIC)
...
.build()
.getRoute(new Callback<DirectionsResponse>() {
// Checkout mapbox tutorials for this part
DirectionsRoute directionsRoute = ...

NavigationLauncherOptions options = NavigationLauncherOptions.builder()
.directionsRoute(directionsRoute)
.unitType(NavigationUnitType.TYPE_METRIC)
.build();

NavigationLauncher.startNavigation(MyActivity.this, options);
}
});

与 com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.13.0 配合良好

关于java - 显示 map 框的导航 View ,方向单位为公里/分钟而不是英里/英尺,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47199033/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com