I'm using points to follow a route.
I add all the points and create a matching route (with mapmatching).
I use .waypoints(0, route.size -1) to clear the in between waypoints.
But, when i starts the navigation, if i quit the route and mapbox needs to reroute, it will send me to the last waypoint directly.
I'd like to have mandatory waypoints but don't want the app to say 'you arrived 脿 your n'th waypoint'
i'd like an annoucement only for the last ('you are arrived').
Hope this is clear
Android API: 26
Mapbox Navigation SDK version: 0.16.0, 6.3.0
have "invisible mandatory waypoints"
Only mandatory waypoints
@vincent-caron this is what i'm currently doing, you will need to overide the SpeechAnnouncement and BannerInstruction
An example implementation was added to the test app https://github.com/mapbox/mapbox-navigation-android/blob/master/app/src/main/java/com/mapbox/services/android/navigation/testapp/activity/navigationui/EmbeddedNavigationActivity.java#L168-L176.
See also updated docs: https://www.mapbox.com/android-docs/navigation/overview/navigation-ui/#listening-to-the-navigationview
The PR for this can be found here #1107
Thanks for the answer, I was thinking about something like that by reading the documentation.
I'll try that ASAP.
Do you have an example also for IOS swift 4 ?
@vincent-caron I don't unfortunatly as i'm currently in the process of developing an app and only deal with Android, maybe speak with one of the MapBox Devs.
@danesfeder @Guardiola31337
No problem, it's already huge to have answered me so fast.
Have good (day, afternoon, night ...) i don't what time you are, but here in France it's the morning.
Hey @vincent-caron, this is a way to handle waypoints with the map matching API. Does this work for you?
@Danny-James Thanks for the quick response here, the team really appreciates the help!
here is my code
MapboxMapMatching.builder()
.accessToken(Mapbox.getAccessToken())
.coordinates(liste)
.waypoints(0, liste.size() / 2, liste.size()-1 )
.steps(true)
.bannerInstructions(true)
.roundaboutExits(true)
.voiceInstructions(true)
.voiceUnits("metric")
.language("fr-FR")
.profile(DirectionsCriteria.PROFILE_WALKING)
.build()
.enqueueCall(new Callback
@Override
public void onResponse(Call<MapMatchingResponse> call, Response<MapMatchingResponse> response) {
if (response.isSuccessful()) {
DirectionsRoute currentRoute = response.body().matchings().get(0).toDirectionRoute();
//CheckBox simuler = findViewById(R.id.chkSimuler);
NavigationLauncherOptions options = NavigationLauncherOptions.builder()
.directionsRoute(currentRoute)
.shouldSimulateRoute(false)
.build();
NavigationLauncher.startNavigation(MainActivity.this, options);
}
}
@Override
public void onFailure(Call<MapMatchingResponse> call, Throwable throwable) {
}
});
in the NavigationLauncherOptions , I don't have the .speechAnnouncementListener(this) option
So it doesn't work
Any ideas ?
@vincent-caron what version of the SDK are you using?
I'm using the following;
implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.16.0'
@vincent-caron Also looking at your implementation you're using the NavigationLauncher I don't believe these listeners are available whilst using NavigationLauncher.
See my implementation below;
private NavigationViewOptions setupOptions(DirectionsRoute directionsRoute) {
NavigationViewOptions.Builder options = NavigationViewOptions.builder();
options.directionsRoute(directionsRoute)
.navigationListener(this)
.progressChangeListener(this)
.routeListener(this)
.shouldSimulateRoute(true)
.speechAnnouncementListener(this)
.bannerInstructionsListener(this);
return options.build();
}
private void startNavigation(DirectionsRoute directionsRoute) {
NavigationViewOptions navigationViewOptions = setupOptions(directionsRoute);
navigationView.startNavigation(navigationViewOptions);
}
You will need to switch from using NavigationLauncher to NavigationView. @danesfeder correct me if I am wrong please.
yes, that what I thought, I 'm going to see how to use the navigationView
Thanks a lot
@vincent-caron take a look at https://www.mapbox.com/android-docs/navigation/overview/navigation-ui/#navigationview-activity-example
@Danny-James is spot-on here @vincent-caron - exactly what I was going to suggest. Because NavigationLauncher creates a completely new Activity for you, we are not able to add listeners like we can with NavigationView (where you can hold on to the reference of the View).
I have this error when trying the navigationview

What am I doing wrong ?
@vincent-caron can you check if you have the following;
OnNavigationReadyCallback
public class ActivityNavigation extends AppCompatActivity implements OnNavigationReadyCallback, NavigationListener,
RouteListener, ProgressChangeListener, SpeechAnnouncementListener, BannerInstructionsListener {
onNavigationReady
@Override
public void onNavigationReady(boolean isRunning) {
}
^ yup exactly, you need to make sure your Activity implements OnNavigationReadyCallback. Thanks @Danny-James
I'll give it a shot asap , stay tune :)
I've tried . It stops on the willVoice, but It doesn't say my sentence,
It keeps the old one :
@Override
public SpeechAnnouncement willVoice(SpeechAnnouncement announcement) {
return announcement.toBuilder().announcement("point de passage").build();
}
I don't hear 'point de passage' ...
FYI : I simulate the route via shouldSimulate(true)
@vincent-caron yeah we were incorrect on our example, which @Danny-James pointed out the other day.
This now demonstrates the correct usage. Sorry about that!
@danesfeder , It works perfectly now. 馃憤
It's fun to hear the same thing for each announcement
I'm closing now, see you for the next question :)