shouldShowOverlay

open fun shouldShowOverlay(guidanceState: AAGuidanceState?, settingsState: AASettingsState?, screenState: AndroidAutoScreenState): Boolean

Determines whether the overlay should be visible given the current state.

The SDK calls this method whenever the guidance state, settings state, or screen state changes. The overlay is shown when this returns true and hidden when it returns false.

The SDK imposes no opinion about WHEN to show the overlay — that decision is entirely delegated to the provider via this method. The default returns true, meaning the overlay is always visible when the provider exists. Override to implement app-specific visibility logic.

Examples

Speed limit overlay (show only during navigation when speed data is available):

override fun shouldShowOverlay(guidanceState, settingsState, screenState) =
screenState == AndroidAutoScreenState.NAVIGATION
&& guidanceState?.currentSpeedLimit != null
&& settingsState?.displaySpeedLimitEnabled == true

Compass overlay (show during map view and navigation):

override fun shouldShowOverlay(guidanceState, settingsState, screenState) =
screenState == AndroidAutoScreenState.MAP_VIEW
|| screenState == AndroidAutoScreenState.NAVIGATION

Always-visible overlay (default behavior):

override fun shouldShowOverlay(guidanceState, settingsState, screenState) = true

Return

true to show the overlay, false to hide it

Parameters

guidanceState

The current guidance state, or null if no GuidanceProvider is set

settingsState

The current settings state, or null if no SettingsProvider is set

screenState

The current Android Auto screen state