Free-drive mode
Free-drive mode is a unique Mapbox Navigation SDK feature that allows drivers to navigate without a set destination. This mode is sometimes referred to as passive navigation.
When to use free-drive mode
The Navigation SDK's free-drive mode snaps the device location to the road using map matching and predicts location updates to prevent visual lags and disruptions in areas with poor GPS coverage (including tunnels).
This allows you to keep the map in your application continually centered on the device’s current location and proactively provide drivers with relevant information about nearby places and roads including traffic, incidents, and points of interest. For example, free-drive mode would be helpful to drivers who are in areas they are familiar with and do not need turn-by-turn instructions, but may want to avoid congested roads.
Implement free-drive mode
The Navigation SDK automatically enters a free-drive state when startTripSession
is called and no route is provided. At that point, the SDK will start to request and propagate location updates via the LocationObserver
.
If the SDK successfully requests a route, the SDK will change from free-drive mode to active guidance mode. After the route is cleared, the SDK will automatically return to free-drive mode as long as the trip session is not stopped.
See a complete example that illustrates how the Navigation SDK's free-drive mode works.