Class CarNavigationTemplate

java.lang.Object
com.codename1.car.CarTemplate
com.codename1.car.CarNavigationTemplate

public class CarNavigationTemplate extends CarTemplate

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).

  • 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: 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: 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: 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: 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: 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: 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: true while guiding
      Returns

      this template, for chaining