Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NavigationView does not reroute if phone screen is off #750

Closed
jeffwasher opened this issue Mar 12, 2018 · 8 comments
Closed

NavigationView does not reroute if phone screen is off #750

jeffwasher opened this issue Mar 12, 2018 · 8 comments
Assignees
Labels
bug Defect to be fixed.

Comments

@jeffwasher
Copy link

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.

@danesfeder
Copy link
Contributor

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!

@jeffwasher
Copy link
Author

jeffwasher commented Mar 12, 2018

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

@danesfeder
Copy link
Contributor

@jeffwasher you're only seeing this issue when the app is in the background?

@jeffwasher
Copy link
Author

That's correct. The screen is off. The voice instructions continue to work until you go off route. Then silence.

@Guardiola31337 Guardiola31337 added the bug Defect to be fixed. label Mar 22, 2018
@Guardiola31337
Copy link
Contributor

@devotaaabel now that #751 has landed 🎉 could you try to reproduce 👇 #750 (comment)

The voice instructions continue to work until you go off route. Then silence.

and 👀 if the issue is still present?

@chooble
Copy link

chooble commented Apr 17, 2018

@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?

@chooble
Copy link

chooble commented Apr 18, 2018

In 0.13 the reroute events are still not fired when the app is in background.

@devotaaabel devotaaabel self-assigned this Apr 18, 2018
@devotaaabel
Copy link
Contributor

cc @akitchen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Defect to be fixed.
Projects
None yet
Development

No branches or pull requests

5 participants