public class CarNavigationTemplate

  1. Object
  2. CarTemplate
  3. CarNavigationTemplate

A turn-by-turn navigation surface: a drawable map (via a CarSurfaceCallback), an optional next-manoeuvre / arrival info strip, and map-control action strips. Maps to androidx.car.app.navigation.model.NavigationTemplate and CPMapTemplate.

Navigation is the only category with a pixel surface and it is the most tightly gated: the app must declare the navigation category and hold the platform navigation entitlement (ios.carplay.navigation build hint on iOS; the builder injects the androidx.car.app.category.NAVIGATION filter and androidx.car.app.MAP_TEMPLATES permission on Android).

Constructors

public CarNavigationTemplate()

Methods

public CarSurfaceCallback getSurfaceCallback()Returns the map drawing callback, or null.
public CarNavigationTemplate setSurfaceCallback(CarSurfaceCallback surfaceCallback)Sets the callback that draws the moving map onto the head-unit surface.
public String getNextManeuver()Returns the next-manoeuvre instruction text, or null.
public CarNavigationTemplate setNextManeuver(String nextManeuver)Sets the next-manoeuvre instruction (e.g. “Turn right onto Main St”).
public String getDistanceRemaining()Returns the remaining-distance string, or null.
public CarNavigationTemplate setDistanceRemaining(String distanceRemaining)Sets the remaining-distance string (e.g. “300 m”).
public String getTimeRemaining()Returns the remaining-time / ETA string, or null.
public CarNavigationTemplate setTimeRemaining(String timeRemaining)Sets the remaining-time / ETA string (e.g. “12 min”).
public CarActionStrip getMapActions()Returns the map-control action strip (zoom, recenter), or null.
public CarNavigationTemplate setMapActions(CarActionStrip mapActions)Sets the map-control action strip (zoom in/out, recenter).
public CarActionStrip getHeaderActions()Returns the header action strip, or null.
public CarNavigationTemplate setHeaderActions(CarActionStrip headerActions)Sets the header action strip.
public boolean isNavigating()Returns true when turn-by-turn guidance is active (the info strip is shown).
public CarNavigationTemplate setNavigating(boolean navigating)Marks whether guidance is active; when true the head unit shows the manoeuvre/ETA strip.

Inherited methods

Constructor details

CarNavigationTemplate

public CarNavigationTemplate()

Method details

getSurfaceCallback

public CarSurfaceCallback getSurfaceCallback()
Returns the map drawing callback, or null.

setSurfaceCallback

public CarNavigationTemplate setSurfaceCallback(CarSurfaceCallback surfaceCallback)
Sets the callback that draws the moving map onto the head-unit surface.

Parameters

surfaceCallback CarSurfaceCallback
the drawing callback

Returns

this template, for chaining

getNextManeuver

public String getNextManeuver()
Returns the next-manoeuvre instruction text, or null.

setNextManeuver

public CarNavigationTemplate setNextManeuver(String nextManeuver)
Sets the next-manoeuvre instruction (e.g. “Turn right onto Main St”).

Parameters

nextManeuver String
the instruction text

Returns

this template, for chaining

getDistanceRemaining

public String getDistanceRemaining()
Returns the remaining-distance string, or null.

setDistanceRemaining

public CarNavigationTemplate setDistanceRemaining(String distanceRemaining)
Sets the remaining-distance string (e.g. “300 m”).

Parameters

distanceRemaining String
the distance text

Returns

this template, for chaining

getTimeRemaining

public String getTimeRemaining()
Returns the remaining-time / ETA string, or null.

setTimeRemaining

public CarNavigationTemplate setTimeRemaining(String timeRemaining)
Sets the remaining-time / ETA string (e.g. “12 min”).

Parameters

timeRemaining String
the time text

Returns

this template, for chaining

getMapActions

public CarActionStrip getMapActions()
Returns the map-control action strip (zoom, recenter), or null.

setMapActions

public CarNavigationTemplate setMapActions(CarActionStrip mapActions)
Sets the map-control action strip (zoom in/out, recenter).

Parameters

mapActions CarActionStrip
the action strip

Returns

this template, for chaining

getHeaderActions

public CarActionStrip getHeaderActions()
Returns the header action strip, or null.

setHeaderActions

public CarNavigationTemplate setHeaderActions(CarActionStrip headerActions)
Sets the header action strip.

Parameters

headerActions CarActionStrip
the action strip

Returns

this template, for chaining

isNavigating

public boolean isNavigating()
Returns true when turn-by-turn guidance is active (the info strip is shown).

setNavigating

public CarNavigationTemplate setNavigating(boolean navigating)
Marks whether guidance is active; when true the head unit shows the manoeuvre/ETA strip.

Parameters

navigating boolean
true while guiding

Returns

this template, for chaining