public class CarNavigationTemplate
- Object
- CarTemplate
- 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
Inherited methods
From CarTemplate
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
surfaceCallbackCarSurfaceCallback- 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
nextManeuverString- 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
distanceRemainingString- 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
timeRemainingString- 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
mapActionsCarActionStrip- 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
headerActionsCarActionStrip- the action strip
Returns
this template, for chaining