DefaultVehiclePositionStrategy

Default VehiclePositionStrategy that centers the vehicle horizontally in the unobscured visible area.

Horizontal Centering

The MapView occupies the full surface, but template UI elements (turn cards, action strips, route list panels) overlay portions of it. This strategy computes the horizontal center of the visible area as a fraction of the full surface width:

horizontalFraction = (visibleArea.left + visibleArea.right) / 2.0 / containerWidth

This adapts to any screen size, format, panel width, and split screen configuration.

Split Screen Threshold

Exposes DEFAULT_SPLIT_SCREEN_THRESHOLD for use by MSDKSurfaceCallback which performs split screen detection in onVisibleAreaChanged. Split screen detection is a separate concern from vehicle positioning and is handled by the callback, not this strategy.

See also

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun computePosition(visibleArea: Rect, containerWidth: Int, containerHeight: Int, screenState: AndroidAutoScreenState): VehiclePosition?

Computes horizontal center of the visible area.