Я новичок в Mapbox и уже несколько дней пытаюсь выяснить, как я могу добавить progressChangeListener в мои NavigationLauncherOptions.
Mapbox.getInstance (this, getString (R.string.access_token) ); setContentView (R.layout.activity_main);
Point originPoint = Point.fromLngLat(-80.311641,25.910195);
Point destinationPoint = Point.fromLngLat(-80.312159, 25.911922);
NavigationRoute.builder(MainActivity.this)
.accessToken(Mapbox.getAccessToken())
.origin(originPoint)
.destination(destinationPoint)
.build()
.getRoute(new Callback<DirectionsResponse>() {
@Override
public void onResponse(Call<DirectionsResponse> call, Response<DirectionsResponse> response) {
currentRoute = response.body().routes().get(0);
NavigationLauncherOptions options = NavigationLauncherOptions.builder()
.directionsRoute(currentRoute)
.shouldSimulateRoute(true)
.build();
NavigationLauncher.startNavigation(MainActivity.this, options);
NavigationViewOptions.Builder optionsNavigate = NavigationViewOptions.builder();
optionsNavigate.progressChangeListener(new ProgressChangeListener() {
@Override
public void onProgressChange(Location location, RouteProgress routeProgress) {
Log.v("RES", String.valueOf(routeProgress.currentState()));
if (routeProgress.currentState().equals(RouteProgressState.ROUTE_ARRIVED)) {
// Execute arrival logic
}
}
});
}
@Override
public void onFailure(Call<DirectionsResponse> call, Throwable throwable) {
}
});
Я пытаюсь прикрепить код, но он не работает. Любая помощь очень ценится. Спасибо