目前我正在尝试在 mapbox 提供的 android 导航 SDK 中创建导航路线。当向查询添加多个航点时,问题就开始了。(下面的查询返回响应并在地图上绘制路线)
NavigationRoute.builder()
.accessToken(Mapbox.getAccessToken())
.origin(start)
.destination(end)
.alternatives(false)
.build()
.getRoute(new Callback<DirectionsResponse>() {
@Override
public void onResponse(@NonNull Call<DirectionsResponse> call, @NonNull Response<DirectionsResponse> response) {
if (response.isSuccessful()) {
try {
assert response.body() != null;
routeodfgoh = response.body().routes().get(0);
if (navigationMapRoute != null) {
navigationMapRoute.removeRoute();
} else {
navigationMapRoute = new NavigationMapRoute(null, mapView, map);
}
//how to draw the map think map matching is work
navigationMapRoute.addRoute(routeodfgoh);
} catch (Exception ex) {
Toast.makeText(MainActivity.this, ex.toString(), Toast.LENGTH_LONG);
}
}
}
@Override
public void onFailure(Call<DirectionsResponse> …Run Code Online (Sandbox Code Playgroud)