MapboxCarMap

class MapboxCarMap(mapInitOptions: MapInitOptions)

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:

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.

Parameters

mapInitOptions

to initialize the MapboxCarMapSurface

Constructors

MapboxCarMap
Link copied to clipboard
fun MapboxCarMap(mapInitOptions: MapInitOptions)
to initialize the MapboxCarMapSurface

Functions

clearObservers
Link copied to clipboard
fun clearObservers()
Optional function to clear all observers registered through registerObserver
equals
Link copied to clipboard
open operator fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
open fun hashCode(): Int
registerObserver
Link copied to clipboard
fun registerObserver(mapboxCarMapObserver: MapboxCarMapObserver): MapboxCarMap
setGestureHandler
Link copied to clipboard
fun setGestureHandler(gestureHandler: MapboxCarMapGestureHandler?)
Override the car gestures with your own implementation.
toString
Link copied to clipboard
open fun toString(): String
unregisterObserver
Link copied to clipboard
fun unregisterObserver(mapboxCarMapObserver: MapboxCarMapObserver)

Properties

carContext
Link copied to clipboard
val carContext: CarContext
Accessor for the carContext provided to the MapInitOptions.
carMapSurface
Link copied to clipboard
val carMapSurface: MapboxCarMapSurface?
Returns the current MapboxCarMapSurface.
edgeInsets
Link copied to clipboard
val edgeInsets: EdgeInsets?
Accessor to the edgeInsets calculated by the car library.
visibleArea
Link copied to clipboard
val visibleArea: Rect?
Accessor to the visible area calculated by the car library.