Skip to main content

Copilot

Developer Preview
Copilot is now in a Developer Preview state. The feature is being actively updated, so the interfaces might change, but we're excited to share it with the community and receive your feedback.

Mapbox Copilot is a Navigation SDK component that collects detailed trace files of navigation sessions together with search analytics data. The Copilot library processes full-trip-trace longitude and latitude data.

Note
Mapbox Copilot is a debugging tool designed to track, test, and improve navigation behaviors during development and testing. It is not intended as a driver feedback or safety monitoring tool. The data and insights provided through Copilot for diagnostic purposes only, supporting developers in identifying issues, optimizing routes, and refining navigation experiences. Avoid using Copilot in production environments or for any end-user-facing purposes, as it is not designed or certified for those scenarios.

Copilot collects information that helps you in two different ways:

  • It makes driver feedback more actionable.
  • It provides Mapbox teams with the necessary information to investigate and resolve driver-reported issues and, consequently, helps speed up SDK updates that improve the driver experience for the entire developer community.

Opt-in feature

Copilot is an opt-in feature, so it is turned off by default. You have the choice to enable it at the application-developer level for your users (drivers) to improve feedback resolution. See the Lifecycle section below for technical details.

Depending on the use case, you can enable Copilot for either all drivers (for example, during a pilot) or a subset of them.

If you enable Copilot, your organization is in charge of obtaining and maintaining all necessary consents and permissions, including providing notice to and obtaining your end users' affirmative, expressed consent before any access or use of Copilot.

Informing end users
As the application developer, you are responsible for communicating to drivers about the data that is being collected from their drives, including what kind of data is being collected and when it is collected.

Installation

Add the library dependency to your build.gradle:

dependencies {
implementation "com.mapbox.navigationcore:copilot:3.5.0"
}

If you use the com.mapbox.navigationcore:android artifact, you do not need to add the copilot dependency explicitly as it is bundled with the rest of the Navigation SDK's features.

Lifecycle

Copilot implements MapboxNavigationObserver, allowing for a direct link to the MapboxNavigation lifecycle.

To start and stop Copilot use MapboxCopilot.start and MapboxCopilot.stop correspondingly. We recommend to connect this API with the Application's lifecycle.

Usage without MapboxNavigationApp
If you do not integrate MapboxNavigationApp you should replace your occurrences of start / stop by MapboxCopilot.onAttached / MapboxCopilot.onDetached respectively.

We also recommend tracking the DeveloperMetadata.copilotSessionId (see DeveloperMetadataObserver) so that Mapbox teams can better act on specific end-user feedback. This ID helps Mapbox teams find the respective traces and troubleshoot issues faster.

Register the DeveloperMetadataObserver interface with your already-instantiated MapboxNavigation object.

mapboxNavigation.registerDeveloperMetadataObserver(developerMetadataObserver)

Don't forget to unregister DeveloperMetadataObserver when you don't need it anymore or when the lifecycle owner sunsets.

override fun onStop() {
super.onStop()
mapboxNavigation.unregisterDeveloperMetadataObserver(developerMetadataObserver)
}

Noting that the DeveloperMetadata.copilotSessionId is generated internally based on the current state within a history recording session and will change when transitioning across states of a trip session (it's empty when the NavigationSessionState is Idle). As in your Copilot lifecycle is not tied to MapboxNavigation / NavigationSessionState, the copilotSessionId will be the same even after calling start (onAttached) / stop (onDetached) APIs.

Options: How data is collected

Nav SDK exposes configuration settings (see NavigationOptions.copilotOptions) to use Copilot in two ways:

  1. Automatic data collection: Enable Copilot for all trips performed by a specific driver (default option).
  2. Manual data collection: Copilot data is only sent when an end user submits negative feedback about a specific route to help take action on the issue.
val navigationOptions = NavigationOptions.Builder(this)
.copilotOptions(
// Set shouldSendHistoryOnlyWithFeedback to true if you want to sent Copilot traces only when an end user submits negative feedback
// By default shouldSendHistoryOnlyWithFeedback is false so there is no need to add CopilotOptions if you want automatic data collection
CopilotOptions.Builder().shouldSendHistoryOnlyWithFeedback(true).build()
).build()

Feedback

Data collection for Copilot is tightly coupled to the Navigation SDK Feedback, which means this is only effective if the feedback events are pushed through MapboxNavigation Feedback APIs.

Search events

If you would like to provide search analytics into Copilot, you can send the search events over to Copilot (see MapboxCopilot.push). This information would include whether a routable point for navigation was available. Copilot helps understand the impact of search results to a navigation session (arrival experience, routable points).

There are two types of events that can be pushed:

// Push a SearchResultsEvent every time a search results response is retrieved.
MapboxCopilot.push(
SearchResultsEvent(
SearchResults("mapbox", "https://mapbox.com", null, null, "?query=test1", null)
)
)
// Push a SearchResultUsedEvent every time a search result is selected.
MapboxCopilot.push(
SearchResultUsedEvent(
SearchResultUsed(
"mapbox",
"test_id",
"mapbox_poi",
"mapbox_address",
HistoryPoint(-77.03396910343713, 38.89992797324407),
null,
)
)
)
More on Mapbox Search SDK
Any search provider can be used with Copilot, including the Mapbox Search SDK. For more details on how the Mapbox Search SDK works, see the Search SDK Integration documentation.

Example

EXAMPLE
Copilot

Learn how to integrate MapboxCopilot with your application.

Was this page helpful?