NavigationView does not reroute if phone screen is off
Navigation works when the phone screen is off, so I assume this is an intended use case. However if the User goes off route while the screen is off, no reroute action happens. Since NavigationViewModel.offRouteEvent and NavigationViewModel.isOffRoute are MutableLiveData, the reroute action won't fire and my RouteListener doesn't receive a call to onOffRoute.
Hey @jeffwasher, what version of the SDK are you using? Also, can you post the code you're using to set up the off-route listener you're talking about here? Thanks!
Hi @danesfeder, I'm using mapbox-android-navigation-ui:0.11.0
Here's where I set the RouteListener (I've got an Activity holding a NavigationView):
@Override
public void onNavigationReady() {
final NavigationViewOptions.Builder options = NavigationViewOptions.builder();
final MapboxNavigationOptions.Builder navigationOptions = MapboxNavigationOptions.builder();
switch (preferredDistanceUnit) {
case KM:
navigationOptions.unitType(NavigationUnitType.TYPE_METRIC);
break;
case MILES:
navigationOptions.unitType(NavigationUnitType.TYPE_IMPERIAL);
break;
}
options.navigationOptions(navigationOptions.build());
options.navigationListener(this);
options.routeListener(this);
DirectionsRoute route = extractRoute(this);
if (route == null) {
reportError(ERROR_ROUTE_NULL);
return;
}
options.directionsRoute(route);
final Intent intent = getIntent();
options.shouldSimulateRoute(intent.getBooleanExtra(EXTRA_SHOULD_SIMULATE, false));
options.progressChangeListener(progressChangeListener);
options.milestoneEventListener(milestoneEventListener);
navigationView.startNavigation(options.build());
presenter.onNavigationStarted();
}
Let me know if you need more. Thanks
@jeffwasher you're only seeing this issue when the app is in the background?
That's correct. The screen is off. The voice instructions continue to work until you go off route. Then silence.
@devotaaabel now that https://github.com/mapbox/mapbox-navigation-android/pull/751 has landed 🎉 could you try to reproduce 👇 https://github.com/mapbox/mapbox-navigation-android/issues/750#issuecomment-372389883
The voice instructions continue to work until you go off route. Then silence.
and 👀 if the issue is still present?
@Guardiola31337 I have the same issue and I'm trying to implement this with 0.13.0-SNAPSHOT, but now I'm not getting any voice instructions :( Do I have to change something to get voice in 0.13?
In 0.13 the reroute events are still not fired when the app is in background.
cc @akitchen