Deliver routes back in RoutesObserver only when they were processed successfully
Refs https://github.com/mapbox/mapbox-navigation-android/pull/5653 where we introduced a dependency for MapboxNavigation#setNavigationRoutes to only deliver the routes back in RoutesObserver after they were processed by the native navigator.
This opens up an opportunity to only return routes that were successfully processed by the native navigator. A route might be valid for display on the map, valid for camera operations, etc. while for any reason not being valid for navigation from Nav Native perspective. Filtering invalid routes out would prevent user confusion and made it easier for developers to catch a problem if a route they set is not delivered back.
We could extend the RoutesUpdatedResult with a collection of routes that were not processed successfully and the reasons for that.
cc @Guardiola31337 @RingerJK @VysotskiVadim
After discussing this issue with NN the following case was found: if at the moment when we enter OffRoute state the location puck reaches some of the alternative routes, we will switch to said alternative instead of doing the reroute. And this alternative does not necessarily have the same destination (if it's provided by the user, also valid for continuation alternatives). So it can actually be a completely different route. This may cause some issues with telemetry and billing. We should probably discuss what we want to do with it.
cc @mskurydin @DenisPryt @AhmerKhan1 @zugaldia @Guardiola31337
In general the NN behaviour is the following:
- if there's an error in
setRoutesmethod, the primary route was not set to native navigator; - if there's no error in
setRoutesmethod, the size of alternatives inNativeSetRouteResultis the same as the size of input list - if some of the alternative routes are invalid, the
setRoutesmethod will NOT return an error but they will be excluded later inonRouteAlternativesChangedmethod.
So I guess that in the context of this issue we can just stop notifying RoutesObservers in case setRoutes method returned an error. Please correct me if I'm wrong. cc @mapbox/navigation-android
Additionally to above
- the SDK doesn't handle a
setRouteerror, where turn-by-turn navigation is not started https://github.com/mapbox/mapbox-navigation-android/blob/1a2557ef6872d11675f5d5dff340f429a379674f/libnavigation-core/src/main/java/com/mapbox/navigation/core/MapboxNavigation.kt#L797-L811
I understand that https://github.com/mapbox/mapbox-navigation-android/pull/5946 addresses failures with the primary route and we're waiting for Nav Native to be able to filter out alternatives immediately as well before we can fully resolve this ticket?
I understand that https://github.com/mapbox/mapbox-navigation-android/pull/5946 addresses failures with the primary route and we're waiting for Nav Native to be able to filter out alternatives immediately as well before we can fully resolve this ticket?
Yes, the NN issue is linked.