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.
-
ClassDescriptionThe 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 aCarPaneTemplate/CarMessageTemplate.Callback invoked when the user activates an in-car element -- aCarRow,CarGridItemorCarAction.An ordered set ofCarActions 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 forCarActionbackgrounds 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 aCarGridTemplate: a large image with a short title and optional secondary text.A grid of image-forwardCarGridItems -- browse categories, station presets, playlist artwork.A scrolling list of selectable rows, optionally grouped intoCarSections, with an optional headerCarActionStrip.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 aCarSurfaceCallback), 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 informationalCarRows (label / value lines) plus up to two action buttons.A single selectable row in aCarListTemplate.One screen of the in-car experience -- the unit of the head-unit back stack.A titled group ofCarRows within aCarListTemplate.The drawing surface callback for aCarNavigationTemplate.The base type for the fixed catalog of in-car templates.