mapbox-navigation-android
mapbox-navigation-android copied to clipboard
NavigationView History APIs not available immediately
Integrating ReplayLocationEngine
found:
- Currently a client cannot interact with the History APIs when using
NavigationView
untilNavigationView#startNavigation
becauseMapboxNavigation
fromNavigationViewModel
(NavigationView#retrieveMapboxNavigation
) is only created afterwards inNavigationView#initialize
- a client can enable it right after (that's what I did 😅) but at that point could be late (some events could be missing)
cc @abhishek1508
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This is still an issue.
This issue affects an even simpler case. I'm creating an app to navigate the user from the user's current location to a selected location. To find a route between these 2 locations, MapboxNavigation's requestRoutes method needs to be called before the startNavigation of NavigationView is called. However, the instance of the MapboxNavigation is instantiated during the startNavigation's call.
Also, I think the sample code shown in https://docs.mapbox.com/android/navigation/overview/#display-a-navigation-ui has the same issue. retrieveMapboxNavigation() is called before startNavigation(). (Well, the code itself works because this.mapboxNavigation is not read in this sample code.)
Hope this issue is prioritised to be resolved.
I forgot to mention that 1.1.0 of navigation ui is used in my environment.
implementation "com.mapbox.navigation:ui:1.1.0"
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-geojson:5.5.0'
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-core:5.5.0'
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-services:5.5.0'
Hey @takeshi4126, MapboxNavigation#requestRoutes
is not meant to be used together with the NavigationView
. NavigationView
accepts the route as a parameter in the NavigationViewOptions.Builder#directionsRoute
and you can obtain the route before starting the navigation with MapboxDirections
wrapper.
If this doesn't give you enough flexibility, you can use the standalone UI components instead, where you can freely interact with and manage the MapboxNavigation
object as needed.
Hi @LukasPaczos, thank you for giving me the instruction. Actually, I decided to use the standalone UI components and so far it meets my requirement.
One issue is that I have to call the MapboxNavigation.requestRoutes() even if I use setRoute() with a DirectionsRoute object obtained separately. Without calling the requireRoutes(), the RouteProgressObserver that I registered kept receiving INVALID_LOCATION status and the voice navigation didn't start. I guess calling requestRoutes() is required to put the MapboxNavigation into the "Active Guidance" state, and setRoute does not make it happen.
If I call requestRoute() after setRoutes() and startTripsSession(), then voice navigation starts. But calling requestRoute() to get the optimized route between 2 points is in my opinion unnecessary if the route is given by setRoutes(), and I appreciate if you have some ideas. Perhaps I'm using the API wrongly.
One issue is that I have to call the MapboxNavigation.requestRoutes() even if I use setRoute() with a DirectionsRoute object obtained separately. Without calling the requireRoutes(), the RouteProgressObserver that I registered kept receiving INVALID_LOCATION status and the voice navigation didn't start.
This is not working as design, and possibly or bug, or an incorrect setup. setRoutes
should result in the same behavior as a successful requestRoutes
. Would you be able to share more about how you're initializing the nav session or the route you're trying to set?
@LukasPaczos Let me try to find a simple case to recreate it and open a new issue, as I'm not using NavigationView any longer and irrelevant to #3092.
Thanks for using the Mapbox Navigation SDK for Android and being a valued customer.
Mapbox will be soon deprecating any support for v0
and v1
versions of the SDK. To facilitate this transition we’re launching a new drop-in UI component into v2
, equivalent to the existing NavigationView
v1
in its design goals, however with a more modern and customizable API.
We plan to launch this new drop-in UI component as a Developer Preview feature in April, as part of the v2.5
series. Since you are using NavigationView
with v1
, we’d love to hear your feedback so that we can incorporate it ahead of a GA release.
If you’re interested in having early access to the upcoming drop-in UI for v2
and its documentation, drop a comment on this ticket or send an email to [email protected]
/cc @zugaldia @AhmerKhan1