NavigationView
An Android View that creates the drop-in UI.
NavigationView when started will ask for Manifest.permission.ACCESS_FINE_LOCATION and Manifest.permission.ACCESS_COARSE_LOCATION. If denied the view will point to a null island. If accepted, this view will always start in Free Drive state with the puck pointing to users current location.
The NavigationView is spread across the following states:
Free Drive: A user will be in free drive state when there is no destination or route set.
DestinationPreview: A user will be in destination preview when a destination is set.
RoutePreview: A user will be in route preview when a destination is set along with a route joining the origin/destination pair.
Active Guidance: A user will be in active guidance when a single destination or multi waypoint route is set and the user has explicitly initiated start navigation action.
Arrival: A user will be in arrival state when they are about to reach the final destination.
NavigationView by default does not uses MapboxReplayer, rather it uses the actual location engine and hooks onto the users current location derived from device GPS. However, this can be overridden and instead you can simulate active guidance by enabling isReplayEnabled
.
Note: NavigationView is Experimental
and the API(s) are subject to breaking changes.
A Mapbox access token must also be set by the developer (to initialize navigation).
Parameters
Defaults to store owner tied to the hosting Activity. If you prefer the lifecycle of the ViewModels internal to NavigationView to be tied to the hosting Fragment instead, provide that Fragment as an argument. Providing a Fragment's store owner allows to achieve tighter memory control if the resources used by the NavigationView shouldn't outlive its hosting Fragment (in anticipation of potential Fragment recreation).
Constructors
Functions
Add a listener that will be notified when NavigationView changes.
Customize the views by implementing your own UIBinder components.
Customize view by providing your own UIBinder components.
Provide custom map styles, route line and arrow options.
Customize standalone UI components styles by providing your own custom styles.
Provides access to ViewLifecycleRegistry
Registers MapViewObserver.
Remove a listener for NavigationView changes.
Unregisters MapViewObserver.