Skip to main content

Free-driving mode

A newer version of the Navigation SDK is available

This page uses v1.4.2 of the Mapbox Navigation SDK. A newer version of the SDK is available. Learn about the latest version, v2.18.1, in the Navigation SDK documentation.

Free-driving 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-driving mode

The Navigation SDK’s free-driving mode snaps the device’s location to the road network using map matching and predicts location updates to prevent visual lags and disruptions in areas with poor GPS coverage (including tunnels). Unlike in turn-by-turn navigation, you do not provide a route and the user does not need to stick to a predefined path.

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-driving 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-driving mode

To enable free-driving mode in an MGLMapView, create a PassiveLocationManager object and set the MGLMapView.locationManager property to it.

To receive these locations without an MGLMapView, use the PassiveLocationDataSource class and implement the PassiveLocationDataSourceDelegate.passiveLocationDataSource(_:didUpdateLocation:rawLocation:) method or observe passiveLocationDataSourceDidUpdate notifications.