public class CarContext
extends ContextWrapper

   ↳ android.content.Context
     ↳ android.content.ContextWrapper

The CarContext class is a ContextWrapper subclass accessible to your CarAppService and Screen instances, which provides access to car services such as the ScreenManager for managing the screen stack, the AppManager for general app-related functionality such as accessing a surface for drawing your navigation app's map, and the NavigationManager used by turn-by-turn navigation apps to communicate navigation metadata and other navigation-related events with the host. See Access the navigation templates for a comprehensive list of library functionality available to navigation apps.

Whenever you use a CarContext to load resources, the following configuration elements come from the car screen's configuration, and not the phone:

  • Screen width.
  • Screen height.
  • Screen pixel density (DPI).
  • Night mode (See isDarkMode()).

Please refer here, on how to use configuration qualifiers in your resources.




Standard action for navigating to a location.


Manages all app events such as invalidating the UI, showing a toast, etc.


Internal usage only.


Manages constraints for the app as enforced by the connected host.


Key for including a IStartCarApp in the notification Intent, for starting the app if it has not been opened yet.


Manages access to properties, sensors and actions.


Manages all navigation events such as starting navigation when focus is granted, abandoning navigation when focus is lost, etc.


Manages the screens of the app, including the screen stack.

Inherited constants

Public methods

void finishCarApp()

Requests to finish the car app.

ComponentName getCallingComponent()

Return the component (service or activity) that invoked this car app.

int getCarAppApiLevel()

Retrieves the API level negotiated with the host.

<T> T getCarService(Class<T> serviceClass)

Returns a car service by class.

Object getCarService(String name)

Provides a car service by name.

String getCarServiceName(Class<?> serviceClass)

Gets the name of the car service that is represented by the specified class.

HostInfo getHostInfo()

Returns information about the host attached to this service.

OnBackPressedDispatcher getOnBackPressedDispatcher()

Returns the OnBackPressedDispatcher that will be triggered when the user clicks a back button.

boolean isDarkMode()

Returns true if the car is set to dark mode.

void requestPermissions(List<String> permissions, OnRequestPermissionsListener listener)

Requests the provided permissions from the user, calling the provided listener in the main thread.

void requestPermissions(List<String> permissions, Executor executor, OnRequestPermissionsListener listener)

Requests the provided permissions from the user.

void setCarAppResult(int resultCode, Intent data)

Sets the result of this car app.

void startCarApp(Intent intent)

Starts a car app on the car screen.

static void startCarApp(Intent notificationIntent, Intent appIntent)

This method is deprecated. use CarPendingIntent.getCarApp(Context, int, Intent, int) to create the pending intent for the notification action. This API will NOT work for Automotive OS.

Inherited methods