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.
Types
class Car | The static entry point for Apple CarPlay and Google Android Auto support. |
class CarAction | A tappable action – a button shown in a CarActionStrip, a header action, or an action attached to a CarPaneTemplate / CarMessageTemplate. |
interface CarActionListener | Callback invoked when the user activates an in-car element – a CarRow, CarGridItem or CarAction. |
class CarActionStrip | An ordered set of CarActions shown together in a head-unit action bar – a template header strip or the navigation map controls. |
class CarApplication | The entry point an app implements to provide its in-car (Apple CarPlay / Google Android Auto) experience. |
enum CarColor | A small, head-unit-safe colour palette for CarAction backgrounds and accents. |
interface CarConnectionListener | Notified when a head unit (Apple CarPlay / Google Android Auto) connects or disconnects. |
class CarContext | The live handle to a connected head unit. |
class CarGridItem | A single cell in a CarGridTemplate: a large image with a short title and optional secondary text. |
class CarGridTemplate | A grid of image-forward CarGridItems – browse categories, station presets, playlist artwork. |
class CarListTemplate | A scrolling list of selectable rows, optionally grouped into CarSections, with an optional header CarActionStrip. |
class CarMessageTemplate | 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. |
class 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. |
class CarNowPlayingTemplate | The system now-playing surface for audio apps. |
class CarPaneTemplate | A detail pane: a handful of informational CarRows (label / value lines) plus up to two action buttons. |
class CarRow | A single selectable row in a CarListTemplate. |
class CarScreen | One screen of the in-car experience – the unit of the head-unit back stack. |
class CarSection | A titled group of CarRows within a CarListTemplate. |
interface CarSurfaceCallback | The drawing surface callback for a CarNavigationTemplate. |
class CarTemplate | The base type for the fixed catalog of in-car templates. |