Package com.codename1.car


package com.codename1.car

Portable in-car UI for Apple CarPlay and Google Android Auto. Apps describe their car experience once with a small catalogue of driver-safe templates (CarListTemplate, CarGridTemplate, CarPaneTemplate, CarMessageTemplate, CarNavigationTemplate, CarNowPlayingTemplate) and Codename One renders them as native CPTemplates on CarPlay and androidx.car.app templates on Android Auto.

Register a CarApplication with Car#setApplication(CarApplication) from your app's init(). The car platforms are template-based, so you cannot show a regular Codename One Form on the head unit -- use the template catalogue. On the simulator and on ports without in-car projection the API is an inert no-op and Car#isCarConnected() returns false, so application code needs no platform conditionals.

Merely referencing this package makes the build wire the native plumbing (the CarPlay scene and entitlement on iOS, the androidx.car.app dependency and CarAppService on Android); apps that never use it pay nothing. See the "In-Car Experiences" chapter of the developer guide.

  • Class
    Description
    The static entry point for Apple CarPlay and Google Android Auto support.
    A tappable action -- a button shown in a CarActionStrip, a header action, or an action attached to a CarPaneTemplate / CarMessageTemplate.
    Callback invoked when the user activates an in-car element -- a CarRow, CarGridItem or CarAction.
    An ordered set of CarActions shown together in a head-unit action bar -- a template header strip or the navigation map controls.
    The entry point an app implements to provide its in-car (Apple CarPlay / Google Android Auto) experience.
    A small, head-unit-safe colour palette for CarAction backgrounds and accents.
    Notified when a head unit (Apple CarPlay / Google Android Auto) connects or disconnects.
    The live handle to a connected head unit.
    A single cell in a CarGridTemplate: a large image with a short title and optional secondary text.
    A grid of image-forward CarGridItems -- browse categories, station presets, playlist artwork.
    A scrolling list of selectable rows, optionally grouped into CarSections, with an optional header CarActionStrip.
    A short message with an icon and action buttons -- an error/empty state, a permission prompt, or (for communication apps) an incoming-message card with read-aloud and voice-reply actions.
    A turn-by-turn navigation surface: a drawable map (via a CarSurfaceCallback), an optional next-manoeuvre / arrival info strip, and map-control action strips.
    The system now-playing surface for audio apps.
    A detail pane: a handful of informational CarRows (label / value lines) plus up to two action buttons.
    A single selectable row in a CarListTemplate.
    One screen of the in-car experience -- the unit of the head-unit back stack.
    A titled group of CarRows within a CarListTemplate.
    The drawing surface callback for a CarNavigationTemplate.
    The base type for the fixed catalog of in-car templates.