Mapbox Car Map
This is the main entry point for controlling the Mapbox car map surface.
You can add the MapboxCarMap to your entire androidx.car.app.Session using the Lifecycle. And then any androidx.car.app.Screen that is using a supported template will automatically show the Mapbox map. You can also, specify a MapboxCarMap for each individual androidx.car.app.Screen by constructing the MapboxCarMap with the screen Lifecycle.
Supported templates include:
androidx.car.app.navigation.model.RoutePreviewNavigationTemplate
androidx.car.app.navigation.model.PlaceListNavigationTemplate
Customize your MapboxCarMap with your own implementations of MapboxCarMapObserver. Use the registerObserver and unregisterObserver functions to load and detach the observers.
The internals of this class use AppManager.setSurfaceCallback, which assumes there is a single surface callback. Do not use setSurfaceCallback, and do not create multiple instances of MapboxCarMap.
Constructors
Functions
Optional function to clear all observers registered through registerObserver
Override the car gestures with your own implementation. If you would like to build a custom experience for handling gestures, you can implement the MapboxCarMapGestureHandler interface, or override the DefaultMapboxCarMapGestureHandler, or set to null to disable gesture handling.
Calls AppManager.setSurfaceCallback to give Mapbox access to render the map onto Android Auto head units. You should only call this once per CarContext in a Session.
Properties
Returns the current MapboxCarMapSurface. It is recommended to use registerObserver and MapboxCarMapObserver to attach and detach your customizations.
Accessor to the edgeInsets calculated by the car library. It is recommended to use the values returned by MapboxCarMapObserver.onVisibleAreaChanged.
The initial options used to setup the map.
Accessor to the visible area calculated by the car library. It is recommended to use the values returned by MapboxCarMapObserver.onVisibleAreaChanged.