Search destination
There are many ways to search for a destination. The SDK provides a few default experiences, which enable you to find a destination without using your phone. Many of the options are available in the search package.
Search backend
The SDK supports two search modes controlled by CarSearchMode: a legacy mode (using Geocoding V5 and an additional search service) and the new Search Box.
CarSearchMode.Legacy is the default for backward compatibility, but it is deprecated because Geocoding V5 no longer returns POI results. This means typed searches and voice-activated navigation ("Navigate to coffee shop") may return incomplete or no results. Migrate to CarSearchMode.SearchBox for full POI support and access to the latest search improvements.
Before enabling Search Box, review the Search Box API pricing as it is billed differently from the legacy APIs.
Enable Search Box in your Session:
private val mapboxCarContext = MapboxCarContext(lifecycle, mapboxCarMap)
.prepareScreens()
.customize {
searchMode = CarSearchMode.SearchBox
}
Search for search queries
SEARCH screen will show a screen that allows the user to search for a destination. Make sure that YOUR_MAPBOX_ACCESS_TOKEN supports Mapbox Search or you will need to bring your own search with the MapboxScreenManager.
Voice activated navigation
You must override the onNewIntent in the Session. The GeoDeeplinkNavigateAction will parse the intent and retrieve results with the GEO_DEEPLINK screen. More documentation is available in the navigation intents section. To implement this yourself, use the Mapbox GeoDeeplinkParser.
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
GeoDeeplinkNavigateAction(mapboxCarContext).onNewIntent(intent)
}