SurfaceCallbackConfig

data class SurfaceCallbackConfig(val overlayProvider: OverlayViewProvider? = null, val vehiclePositionStrategy: VehiclePositionStrategy? = DefaultVehiclePositionStrategy(), val gestureConfig: GestureConfig = GestureConfig(), val defaultCenterOnZoomLevel: Double = 13.0, val zoomButtonStep: Double = 1.0, val maxZoomLevel: Double = 22.5, val zoomToRectInsets: ZoomToRectInsets = ZoomToRectInsets(), val mapViewDestroyDelayMs: Long = 100, val mapCreationMaxRetries: Int = 10, val mapCreationRetryDelayMs: Long = 500)

Central configuration object for MSDKSurfaceCallback.

Every opinionated behavior in the SurfaceCallback has a configurable parameter with a sensible default matching the standard navigation app behavior. Clients can customize any aspect without subclassing.

Design Principles

  • Defaults match standard behavior: Zero-config usage produces a working navigation experience.

  • Nullable = disableable: Setting a strategy/provider to null disables that behavior entirely.

  • Progressive disclosure: Simple use cases need minimal configuration; advanced customization is available but not required.

Usage

// Minimal config (all defaults)
val config = SurfaceCallbackConfig()

// Custom overlay + adjusted zoom
val config = SurfaceCallbackConfig(
overlayProvider = MySpeedLimitOverlayProvider(),
zoomButtonStep = 0.5,
zoomToRectInsets = ZoomToRectInsets(left = 0.15f, right = 0.15f)
)

// Disable gestures and vehicle repositioning
val config = SurfaceCallbackConfig(
gestureConfig = GestureConfig(scrollEnabled = false, scaleEnabled = false),
vehiclePositionStrategy = null
)

See also

Constructors

Link copied to clipboard
constructor(overlayProvider: OverlayViewProvider? = null, vehiclePositionStrategy: VehiclePositionStrategy? = DefaultVehiclePositionStrategy(), gestureConfig: GestureConfig = GestureConfig(), defaultCenterOnZoomLevel: Double = 13.0, zoomButtonStep: Double = 1.0, maxZoomLevel: Double = 22.5, zoomToRectInsets: ZoomToRectInsets = ZoomToRectInsets(), mapViewDestroyDelayMs: Long = 100, mapCreationMaxRetries: Int = 10, mapCreationRetryDelayMs: Long = 500)

Properties

Link copied to clipboard

Default zoom level used when centering the map on the cached initial position.

Link copied to clipboard

Configuration for gesture handling (pan, zoom, fling).

Link copied to clipboard

Maximum number of retry attempts for MapView creation.

Link copied to clipboard

Delay in milliseconds between MapView creation retry attempts.

Link copied to clipboard

Delay in milliseconds between Navigation.detachMapView() and MapView.onDestroy().

Link copied to clipboard

Maximum allowed zoom level for the map.

Link copied to clipboard

Custom overlay view provider for drawing on top of the MapView.

Link copied to clipboard

Strategy for positioning the vehicle icon on the map.

Link copied to clipboard

Zoom level change per zoom button tap (one full map tile level).

Link copied to clipboard

Fractional insets for fitting geographic bounding boxes within the visible area.