GuidanceProvider

Interface for providing navigation guidance data to Android Auto.

This interface abstracts the guidance functionality needed by the Android Auto module, allowing it to display turn-by-turn navigation without depending on the phone app's specific implementation (e.g., GuidanceViewModel from navigating_presentation).

Architecture

This interface follows the same pattern as MapController:

┌─────────────────────────────────────────────────────────────────────┐
│ androidauto │
│ GuidanceProvider (this interface) │
│ - Base interface with StateFlow and control methods │
└─────────────────────────────────────────────────────────────────────┘
▲
│ extends
┌─────────────────────────────────────────────────────────────────────┐
│ android_auto (app module) │
│ GuidanceProviderWithViewModel │
│ - Extended interface with getGuidanceViewModel() │
└─────────────────────────────────────────────────────────────────────┘
▲
│ implements
┌─────────────────────────────────────────────────────────────────────┐
│ app │
│ GuidanceProviderAdapter │
│ - Wraps GuidanceViewModel │
│ - Converts GuidanceState → AAGuidanceState │
│ - Converts Bitmap → ByteArray │
└─────────────────────────────────────────────────────────────────────┘

State Flow

The guidanceState StateFlow provides real-time navigation updates:

  • Maneuver icons and instructions

  • Distance and duration to destination

  • ETA and speed information

  • Audio mute state

Control Methods

Control methods allow Android Auto to trigger navigation actions:

Usage

Android Auto screens access the provider via AndroidAutoSurfaceHolder:

val provider = AndroidAutoSurfaceManager.getHolder().getGuidanceProvider()
if (provider != null) {
scope.launch {
provider.guidanceState.collect { state ->
// Update NavigationTemplate with new state
}
}
}

See also

GuidanceEventListener

Inheritors

Properties

Link copied to clipboard
abstract val guidanceState: StateFlow<AAGuidanceState>

StateFlow of the current guidance state.

Link copied to clipboard
abstract val isGuidanceActive: StateFlow<Boolean>

StateFlow indicating whether guidance is currently active.

Functions

Link copied to clipboard

Checks if the destination has been reached.

Link copied to clipboard
open fun isMuted(): Boolean

Checks if voice guidance is currently muted.

Link copied to clipboard
abstract fun recenter()

Recenters the map on the current position with navigation tracking.

Link copied to clipboard
abstract fun startNavigation()

Starts turn-by-turn navigation with the currently selected route.

Link copied to clipboard
abstract fun stopNavigation()

Stops the current navigation session.

Link copied to clipboard
abstract fun toggleMute()

Toggles voice guidance mute state.