# CarContext

Artifact: [androidx.car.app:app](https://developer.android.com/jetpack/androidx/releases/car-app) [View Source](https://cs.android.com/search?q=file:androidx/car/app/CarContext.java+class:androidx.car.app.CarContext) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

*** ** * ** ***


```
public class CarContext extends ContextWrapper
```

<br />

|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||||
| ↳ | [android.content.Context](https://developer.android.com/reference/android/content/Context.html) |||
|   | ↳ | [android.content.ContextWrapper](https://developer.android.com/reference/android/content/ContextWrapper.html) ||
|   |   | ↳ | [androidx.car.app.CarContext](https://developer.android.com/reference/androidx/car/app/CarContext) |

Known direct subclasses [TestCarContext](https://developer.android.com/reference/androidx/car/app/testing/TestCarContext)

|---|---|
| `https://developer.android.com/reference/androidx/car/app/testing/TestCarContext` | The `https://developer.android.com/reference/androidx/car/app/CarContext` that is used for testing. |

*** ** * ** ***

The CarContext class is a `https://developer.android.com/reference/android/content/ContextWrapper.html` subclass accessible to your `https://developer.android.com/reference/androidx/car/app/CarAppService` and `https://developer.android.com/reference/androidx/car/app/Screen` instances, which provides access to car services such as the `https://developer.android.com/reference/androidx/car/app/ScreenManager` for managing the screen stack, the `https://developer.android.com/reference/androidx/car/app/AppManager` for general app-related functionality such as accessing a surface for drawing your navigation app's map, and the `https://developer.android.com/reference/androidx/car/app/navigation/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 `https://developer.android.com/reference/androidx/car/app/CarContext#isDarkMode()`).

Please refer [here](https://developer.android.com/guide/topics/resources/providing-resources), on how to use configuration qualifiers in your resources.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/car/app/CarContext#getCarService(java.lang.String)` |   |

## Summary

| ### Constants |
|---|---|
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/car/app/CarContext#ACTION_NAVIGATE() = "androidx.car.app.action.NAVIGATE"` Standard action for navigating to a location. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/car/app/CarContext#APP_SERVICE() = "app"` Manages all app events such as invalidating the UI, showing a toast, etc. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/car/app/CarContext#CAR_SERVICE() = "car"` Internal usage only. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `@https://developer.android.com/reference/androidx/car/app/annotations/RequiresCarApi(value = 2) https://developer.android.com/reference/androidx/car/app/CarContext#CONSTRAINT_SERVICE() = "constraints"` Manages constraints for the app as enforced by the connected host. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/car/app/CarContext#EXTRA_START_CAR_APP_BINDER_KEY() = "androidx.car.app.extra.START_CAR_APP_BINDER_KEY"` Key for including a IStartCarApp in the notification `https://developer.android.com/reference/android/content/Intent.html`, for starting the app if it has not been opened yet. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `@https://developer.android.com/reference/androidx/car/app/annotations/RequiresCarApi(value = 3) https://developer.android.com/reference/androidx/car/app/CarContext#HARDWARE_SERVICE() = "hardware"` Manages access to androidx.car.app.hardware properties, sensors and actions. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `@https://developer.android.com/reference/androidx/car/app/annotations/RequiresCarApi(value = 8) https://developer.android.com/reference/androidx/car/app/CarContext#MEDIA_PLAYBACK_SERVICE() = "media_playback"` Manages the media requests from 3p apps such as providing a media session token, |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/car/app/CarContext#NAVIGATION_SERVICE() = "navigation"` Manages all navigation events such as starting navigation when focus is granted, abandoning navigation when focus is lost, etc. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/car/app/CarContext#SCREEN_SERVICE() = "screen"` Manages the screens of the app, including the screen stack. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/car/app/CarContext#SUGGESTION_SERVICE() = "suggestion"` Manages posting suggestion events |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/car/app/CarContext#finishCarApp()()` Requests to finish the car app. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/content/ComponentName.html` | `@https://developer.android.com/reference/androidx/car/app/annotations/RequiresCarApi(value = 2) https://developer.android.com/reference/androidx/car/app/CarContext#getCallingComponent()()` Return the component (service or activity) that invoked this car app. |
| `int` | `https://developer.android.com/reference/androidx/car/app/CarContext#getCarAppApiLevel()()` Retrieves the API level negotiated with the host. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/Object.html` | `https://developer.android.com/reference/androidx/car/app/CarContext#getCarService(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html name)` Provides a car service by name. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `<T> https://developer.android.com/reference/androidx/car/app/CarContext#getCarService(java.lang.Class<T>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/Class.html<T> serviceClass)` Returns a car service by class. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/car/app/CarContext#getCarServiceName(java.lang.Class<?>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> serviceClass)` Gets the name of the car service that is represented by the specified class. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/car/app/HostInfo` | `https://developer.android.com/reference/androidx/car/app/CarContext#getHostInfo()()` Returns information about the host attached to this service. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/activity/OnBackPressedDispatcher` | `https://developer.android.com/reference/androidx/car/app/CarContext#getOnBackPressedDispatcher()()` Returns the `https://developer.android.com/reference/androidx/activity/OnBackPressedDispatcher` that will be triggered when the user clicks a back button. |
| `boolean` | `https://developer.android.com/reference/androidx/car/app/CarContext#isDarkMode()()` Returns `true` if the car is set to dark mode. |
| `void` | `https://developer.android.com/reference/androidx/car/app/CarContext#requestPermissions(java.util.List<java.lang.String>,androidx.car.app.OnRequestPermissionsListener)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html> permissions, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/OnRequestPermissionsListener listener )` Requests the provided `permissions` from the user, calling the provided ` listener` in the main thread. |
| `void` | `https://developer.android.com/reference/androidx/car/app/CarContext#requestPermissions(java.util.List<java.lang.String>,java.util.concurrent.Executor,androidx.car.app.OnRequestPermissionsListener)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html> permissions, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/concurrent/Executor.html executor, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/OnRequestPermissionsListener listener )` Requests the provided `permissions` from the user. |
| `void` | `@https://developer.android.com/reference/androidx/car/app/annotations/RequiresCarApi(value = 2) https://developer.android.com/reference/androidx/car/app/CarContext#setCarAppResult(int,android.content.Intent)(int resultCode, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/content/Intent.html data)` Sets the result of this car app. |
| `void` | `https://developer.android.com/reference/androidx/car/app/CarContext#startCarApp(android.content.Intent)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html intent)` Starts a car app on the car screen. |
| `static void` | `[startCarApp](https://developer.android.com/reference/androidx/car/app/CarContext#startCarApp(android.content.Intent,android.content.Intent))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html notificationIntent, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html appIntent)` **This method is deprecated.** use `https://developer.android.com/reference/androidx/car/app/notification/CarPendingIntent#getCarApp(android.content.Context,int,android.content.Intent,int)` to create the pending intent for the notification action. <br /> |

### Inherited Constants

From [android.content.Context](https://developer.android.com/reference/android/content/Context.html) `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#ACCESSIBILITY_SERVICE = "accessibility"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#ACCOUNT_SERVICE = "account"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#ACTIVITY_SERVICE = "activity"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#ADVANCED_PROTECTION_SERVICE = "advanced_protection"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#ALARM_SERVICE = "alarm"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#APPWIDGET_SERVICE = "appwidget"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#APP_FUNCTION_SERVICE = "app_function"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#APP_OPS_SERVICE = "appops"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#APP_SEARCH_SERVICE = "app_search"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#AUDIO_SERVICE = "audio"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#AUTOFILL_SERVICE = "autofill"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#BATTERY_SERVICE = "batterymanager"` `static final int` `https://developer.android.com/reference/android/content/Context.html#BIND_ABOVE_CLIENT = 8` `static final int` `https://developer.android.com/reference/android/content/Context.html#BIND_ADJUST_WITH_ACTIVITY = 128` `static final int` `https://developer.android.com/reference/android/content/Context.html#BIND_ALLOW_ACTIVITY_STARTS = 512` `static final int` `https://developer.android.com/reference/android/content/Context.html#BIND_ALLOW_OOM_MANAGEMENT = 16` `static final int` `https://developer.android.com/reference/android/content/Context.html#BIND_AUTO_CREATE = 1` `static final int` `https://developer.android.com/reference/android/content/Context.html#BIND_DEBUG_UNBIND = 2` `static final int` `https://developer.android.com/reference/android/content/Context.html#BIND_EXTERNAL_SERVICE = -2147483648` `static final long` `https://developer.android.com/reference/android/content/Context.html#BIND_EXTERNAL_SERVICE_LONG = 4611686018427387904` `static final int` `https://developer.android.com/reference/android/content/Context.html#BIND_IMPORTANT = 64` `static final int` `https://developer.android.com/reference/android/content/Context.html#BIND_INCLUDE_CAPABILITIES = 4096` `static final int` `https://developer.android.com/reference/android/content/Context.html#BIND_NOT_FOREGROUND = 4` `static final int` `https://developer.android.com/reference/android/content/Context.html#BIND_NOT_PERCEPTIBLE = 256` `static final int` `https://developer.android.com/reference/android/content/Context.html#BIND_PACKAGE_ISOLATED_PROCESS = 16384` `static final int` `https://developer.android.com/reference/android/content/Context.html#BIND_SHARED_ISOLATED_PROCESS = 8192` `static final int` `https://developer.android.com/reference/android/content/Context.html#BIND_WAIVE_PRIORITY = 32` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#BIOMETRIC_SERVICE = "biometric"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#BLOB_STORE_SERVICE = "blob_store"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#BLUETOOTH_SERVICE = "bluetooth"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#BUGREPORT_SERVICE = "bugreport"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#CAMERA_SERVICE = "camera"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#CAPTIONING_SERVICE = "captioning"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#CARRIER_CONFIG_SERVICE = "carrier_config"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#CHOOSER_SERVICE = "chooser"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#CLIPBOARD_SERVICE = "clipboard"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#COMPANION_DEVICE_SERVICE = "companiondevice"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#CONNECTIVITY_DIAGNOSTICS_SERVICE = "connectivity_diagnostics"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#CONNECTIVITY_SERVICE = "connectivity"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#CONSUMER_IR_SERVICE = "consumer_ir"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#CONTACT_KEYS_SERVICE = "contact_keys"` `static final int` `https://developer.android.com/reference/android/content/Context.html#CONTEXT_IGNORE_SECURITY = 2` `static final int` `https://developer.android.com/reference/android/content/Context.html#CONTEXT_INCLUDE_CODE = 1` `static final int` `https://developer.android.com/reference/android/content/Context.html#CONTEXT_RESTRICTED = 4` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#CREDENTIAL_SERVICE = "credential"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#CROSS_PROFILE_APPS_SERVICE = "crossprofileapps"` `static final int` `https://developer.android.com/reference/android/content/Context.html#DEVICE_ID_DEFAULT = 0` `static final int` `https://developer.android.com/reference/android/content/Context.html#DEVICE_ID_INVALID = -1` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#DEVICE_LOCK_SERVICE = "device_lock"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#DEVICE_POLICY_SERVICE = "device_policy"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#DISPLAY_HASH_SERVICE = "display_hash"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#DISPLAY_SERVICE = "display"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#DOMAIN_VERIFICATION_SERVICE = "domain_verification"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#DOWNLOAD_SERVICE = "download"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#DROPBOX_SERVICE = "dropbox"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#EUICC_SERVICE = "euicc"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#FILE_INTEGRITY_SERVICE = "file_integrity"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#FILE_SERVICE = "file"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#GAME_SERVICE = "game"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#GRAMMATICAL_INFLECTION_SERVICE = "grammatical_inflection"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#HARDWARE_PROPERTIES_SERVICE = "hardware_properties"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#HEALTHCONNECT_SERVICE = "healthconnect"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#INPUT_METHOD_SERVICE = "input_method"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#INPUT_SERVICE = "input"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#IPSEC_SERVICE = "ipsec"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#JOB_SCHEDULER_SERVICE = "jobscheduler"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#KEYGUARD_SERVICE = "keyguard"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#KEYSTORE_SERVICE = "keystore"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#LAUNCHER_APPS_SERVICE = "launcherapps"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#LAYOUT_INFLATER_SERVICE = "layout_inflater"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#LOCALE_SERVICE = "locale"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#LOCATION_SERVICE = "location"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#MEDIA_COMMUNICATION_SERVICE = "media_communication"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#MEDIA_METRICS_SERVICE = "media_metrics"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#MEDIA_PROJECTION_SERVICE = "media_projection"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#MEDIA_QUALITY_SERVICE = "media_quality"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#MEDIA_ROUTER_SERVICE = "media_router"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#MEDIA_SESSION_SERVICE = "media_session"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#MIDI_SERVICE = "midi"` `static final int` `https://developer.android.com/reference/android/content/Context.html#MODE_APPEND = 32768` `static final int` `https://developer.android.com/reference/android/content/Context.html#MODE_ENABLE_WRITE_AHEAD_LOGGING = 8` `static final int` `https://developer.android.com/reference/android/content/Context.html#MODE_MULTI_PROCESS = 4`

**This field is deprecated.**
`static final int` `https://developer.android.com/reference/android/content/Context.html#MODE_NO_LOCALIZED_COLLATORS = 16` `static final int` `https://developer.android.com/reference/android/content/Context.html#MODE_PRIVATE = 0` `static final int` `https://developer.android.com/reference/android/content/Context.html#MODE_WORLD_READABLE = 1`

**This field is deprecated.**
`static final int` `https://developer.android.com/reference/android/content/Context.html#MODE_WORLD_WRITEABLE = 2`

**This field is deprecated.**
`static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#NETWORK_STATS_SERVICE = "netstats"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#NFC_SERVICE = "nfc"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#NOTIFICATION_SERVICE = "notification"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#NPU_SERVICE = "npu"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#NSD_SERVICE = "servicediscovery"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#OVERLAY_SERVICE = "overlay"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#PCC_SANDBOX_SERVICE = "pcc_sandbox"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#PEOPLE_SERVICE = "people"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#PERFORMANCE_HINT_SERVICE = "performance_hint"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#PERSISTENT_DATA_BLOCK_SERVICE = "persistent_data_block"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#POWER_SERVICE = "power"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#PRINT_SERVICE = "print"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#PROFILING_SERVICE = "profiling"` `static final int` `https://developer.android.com/reference/android/content/Context.html#RECEIVER_EXPORTED = 2` `static final int` `https://developer.android.com/reference/android/content/Context.html#RECEIVER_NOT_EXPORTED = 4` `static final int` `https://developer.android.com/reference/android/content/Context.html#RECEIVER_VISIBLE_TO_INSTANT_APPS = 1` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#RESTRICTIONS_SERVICE = "restrictions"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#ROLE_SERVICE = "role"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#SATELLITE_SERVICE = "satellite"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#SEARCH_SERVICE = "search"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#SECURITY_STATE_SERVICE = "security_state"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#SENSOR_SERVICE = "sensor"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#SERIAL_SERVICE = "serial"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#SHORTCUT_SERVICE = "shortcut"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#STATUS_BAR_SERVICE = "statusbar"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#STORAGE_SERVICE = "storage"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#STORAGE_STATS_SERVICE = "storagestats"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#SYSTEM_HEALTH_SERVICE = "systemhealth"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#TELECOM_SERVICE = "telecom"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#TELEPHONY_IMS_SERVICE = "telephony_ims"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#TELEPHONY_PHONE_NUMBER_SERVICE = "telephony_phone_number"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#TELEPHONY_SERVICE = "phone"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#TELEPHONY_SUBSCRIPTION_SERVICE = "telephony_subscription_service"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#TETHERING_SERVICE = "tethering"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#TEXT_CLASSIFICATION_SERVICE = "textclassification"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#TEXT_SERVICES_MANAGER_SERVICE = "textservices"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#TV_AD_SERVICE = "tv_ad"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#TV_INPUT_SERVICE = "tv_input"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#TV_INTERACTIVE_APP_SERVICE = "tv_interactive_app"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#UI_MODE_SERVICE = "uimode"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#USAGE_STATS_SERVICE = "usagestats"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#USB_SERVICE = "usb"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#USER_SERVICE = "user"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#VIBRATOR_MANAGER_SERVICE = "vibrator_manager"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#VIBRATOR_SERVICE = "vibrator"`

**This field is deprecated.**
`static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#VIRTUAL_DEVICE_SERVICE = "virtualdevice"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#VPN_MANAGEMENT_SERVICE = "vpn_management"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#WALLPAPER_SERVICE = "wallpaper"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#WEB_APP_SERVICE = "web_app"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#WIFI_AWARE_SERVICE = "wifiaware"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#WIFI_P2P_SERVICE = "wifip2p"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#WIFI_RTT_RANGING_SERVICE = "wifirtt"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#WIFI_SERVICE = "wifi"` `static final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#WINDOW_SERVICE = "window"`

### Inherited methods

From [android.content.Context](https://developer.android.com/reference/android/content/Context.html) `final int` `https://developer.android.com/reference/android/content/Context.html#getColor(int)(int id)` `final https://developer.android.com/reference/android/content/res/ColorStateList.html` `https://developer.android.com/reference/android/content/Context.html#getColorStateList(int)(int id)` `final https://developer.android.com/reference/android/graphics/drawable/Drawable.html` `https://developer.android.com/reference/android/content/Context.html#getDrawable(int)(int id)` `final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/Context.html#getString(int)(int resId)` `final T` `<T> https://developer.android.com/reference/android/content/Context.html#getSystemService(java.lang.Class&lt;T&gt;)(https://developer.android.com/reference/java/lang/Class.html<T> serviceClass)` `final https://developer.android.com/reference/java/lang/CharSequence.html` `https://developer.android.com/reference/android/content/Context.html#getText(int)(int resId)` `https://developer.android.com/reference/android/content/Context.BindServiceFlags.html` `https://developer.android.com/reference/android/content/Context.html#getUpdateableFlags()()` `final https://developer.android.com/reference/android/content/res/TypedArray.html` `https://developer.android.com/reference/android/content/Context.html#obtainStyledAttributes(android.util.AttributeSet, int[])(https://developer.android.com/reference/android/util/AttributeSet.html set, int[] attrs)` `void` `https://developer.android.com/reference/android/content/Context.html#revokeSelfPermissionOnKill(java.lang.String)(https://developer.android.com/reference/java/lang/String.html permName)` `void` `https://developer.android.com/reference/android/content/Context.html#sendBroadcastWithMultiplePermissions(android.content.Intent, java.lang.String[])(
https://developer.android.com/reference/android/content/Intent.html intent,
String[] receiverPermissions
)` From [android.content.ContextWrapper](https://developer.android.com/reference/android/content/ContextWrapper.html) `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#attachBaseContext(android.content.Context)(https://developer.android.com/reference/android/content/Context.html base)` `boolean` `https://developer.android.com/reference/android/content/ContextWrapper.html#bindIsolatedService(android.content.Intent, int, java.lang.String, java.util.concurrent.Executor, android.content.ServiceConnection)(
https://developer.android.com/reference/android/content/Intent.html service,
int flags,
https://developer.android.com/reference/java/lang/String.html instanceName,
https://developer.android.com/reference/java/util/concurrent/Executor.html executor,
https://developer.android.com/reference/android/content/ServiceConnection.html conn
)` `boolean` `https://developer.android.com/reference/android/content/ContextWrapper.html#bindService(android.content.Intent, android.content.Context.BindServiceFlags, java.util.concurrent.Executor, android.content.ServiceConnection)(
https://developer.android.com/reference/android/content/Intent.html service,
https://developer.android.com/reference/android/content/Context.BindServiceFlags.html flags,
https://developer.android.com/reference/java/util/concurrent/Executor.html executor,
https://developer.android.com/reference/android/content/ServiceConnection.html conn
)` `boolean` `https://developer.android.com/reference/android/content/ContextWrapper.html#bindServiceAsUser(android.content.Intent, android.content.ServiceConnection, android.content.Context.BindServiceFlags, android.os.UserHandle)(
https://developer.android.com/reference/android/content/Intent.html service,
https://developer.android.com/reference/android/content/ServiceConnection.html conn,
https://developer.android.com/reference/android/content/Context.BindServiceFlags.html flags,
https://developer.android.com/reference/android/os/UserHandle.html user
)` `int` `https://developer.android.com/reference/android/content/ContextWrapper.html#checkCallingOrSelfPermission(java.lang.String)(https://developer.android.com/reference/java/lang/String.html permission)` `int` `https://developer.android.com/reference/android/content/ContextWrapper.html#checkCallingOrSelfUriPermission(android.net.Uri, int)(https://developer.android.com/reference/android/net/Uri.html uri, int modeFlags)` `int[]` `https://developer.android.com/reference/android/content/ContextWrapper.html#checkCallingOrSelfUriPermissions(java.util.List&lt;android.net.Uri&gt;, int)(https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/android/net/Uri.html> uris, int modeFlags)` `int` `https://developer.android.com/reference/android/content/ContextWrapper.html#checkCallingPermission(java.lang.String)(https://developer.android.com/reference/java/lang/String.html permission)` `int` `https://developer.android.com/reference/android/content/ContextWrapper.html#checkCallingUriPermission(android.net.Uri, int)(https://developer.android.com/reference/android/net/Uri.html uri, int modeFlags)` `int[]` `https://developer.android.com/reference/android/content/ContextWrapper.html#checkCallingUriPermissions(java.util.List&lt;android.net.Uri&gt;, int)(https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/android/net/Uri.html> uris, int modeFlags)` `int` `https://developer.android.com/reference/android/content/ContextWrapper.html#checkContentUriPermissionFull(android.net.Uri, int, int, int)(https://developer.android.com/reference/android/net/Uri.html uri, int pid, int uid, int modeFlags)` `int` `https://developer.android.com/reference/android/content/ContextWrapper.html#checkPermission(java.lang.String, int, int)(https://developer.android.com/reference/java/lang/String.html permission, int pid, int uid)` `int` `https://developer.android.com/reference/android/content/ContextWrapper.html#checkSelfPermission(java.lang.String)(https://developer.android.com/reference/java/lang/String.html permission)` `int` `https://developer.android.com/reference/android/content/ContextWrapper.html#checkUriPermission(android.net.Uri, int, int, int)(https://developer.android.com/reference/android/net/Uri.html uri, int pid, int uid, int modeFlags)` `int[]` `https://developer.android.com/reference/android/content/ContextWrapper.html#checkUriPermissions(java.util.List&lt;android.net.Uri&gt;, int, int, int)(https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/android/net/Uri.html> uris, int pid, int uid, int modeFlags)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#clearWallpaper()()`

**This method is deprecated.**
`https://developer.android.com/reference/android/content/Context.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#createAttributionContext(java.lang.String)(https://developer.android.com/reference/java/lang/String.html attributionTag)` `https://developer.android.com/reference/android/content/Context.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#createConfigurationContext(android.content.res.Configuration)(https://developer.android.com/reference/android/content/res/Configuration.html overrideConfiguration)` `https://developer.android.com/reference/android/content/Context.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#createContext(android.content.ContextParams)(https://developer.android.com/reference/android/content/ContextParams.html contextParams)` `https://developer.android.com/reference/android/content/Context.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#createContextForSplit(java.lang.String)(https://developer.android.com/reference/java/lang/String.html splitName)` `https://developer.android.com/reference/android/content/Context.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#createDeviceContext(int)(int deviceId)` `https://developer.android.com/reference/android/content/Context.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#createDeviceProtectedStorageContext()()` `https://developer.android.com/reference/android/content/Context.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#createDisplayContext(android.view.Display)(https://developer.android.com/reference/android/view/Display.html display)` `https://developer.android.com/reference/android/content/Context.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#createPackageContext(java.lang.String, int)(https://developer.android.com/reference/java/lang/String.html packageName, int flags)` `https://developer.android.com/reference/android/content/Context.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#createWindowContext(android.view.Display, int, android.os.Bundle)(https://developer.android.com/reference/android/view/Display.html display, int type, https://developer.android.com/reference/android/os/Bundle.html options)` `String[]` `https://developer.android.com/reference/android/content/ContextWrapper.html#databaseList()()` `boolean` `https://developer.android.com/reference/android/content/ContextWrapper.html#deleteDatabase(java.lang.String)(https://developer.android.com/reference/java/lang/String.html name)` `boolean` `https://developer.android.com/reference/android/content/ContextWrapper.html#deleteFile(java.lang.String)(https://developer.android.com/reference/java/lang/String.html name)` `boolean` `https://developer.android.com/reference/android/content/ContextWrapper.html#deleteSharedPreferences(java.lang.String)(https://developer.android.com/reference/java/lang/String.html name)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#enforceCallingOrSelfPermission(java.lang.String, java.lang.String)(https://developer.android.com/reference/java/lang/String.html permission, https://developer.android.com/reference/java/lang/String.html message)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#enforceCallingOrSelfUriPermission(android.net.Uri, int, java.lang.String)(
https://developer.android.com/reference/android/net/Uri.html uri,
int modeFlags,
https://developer.android.com/reference/java/lang/String.html message
)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#enforceCallingPermission(java.lang.String, java.lang.String)(https://developer.android.com/reference/java/lang/String.html permission, https://developer.android.com/reference/java/lang/String.html message)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#enforceCallingUriPermission(android.net.Uri, int, java.lang.String)(https://developer.android.com/reference/android/net/Uri.html uri, int modeFlags, https://developer.android.com/reference/java/lang/String.html message)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#enforcePermission(java.lang.String, int, int, java.lang.String)(https://developer.android.com/reference/java/lang/String.html permission, int pid, int uid, https://developer.android.com/reference/java/lang/String.html message)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#enforceUriPermission(android.net.Uri, int, int, int, java.lang.String)(
https://developer.android.com/reference/android/net/Uri.html uri,
int pid,
int uid,
int modeFlags,
https://developer.android.com/reference/java/lang/String.html message
)` `String[]` `https://developer.android.com/reference/android/content/ContextWrapper.html#fileList()()` `https://developer.android.com/reference/android/content/Context.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getApplicationContext()()` `https://developer.android.com/reference/android/content/pm/ApplicationInfo.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getApplicationInfo()()` `https://developer.android.com/reference/android/content/res/AssetManager.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getAssets()()` `https://developer.android.com/reference/android/content/AttributionSource.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getAttributionSource()()` `https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getAttributionTag()()` `https://developer.android.com/reference/android/content/Context.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getBaseContext()()` `https://developer.android.com/reference/java/io/File.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getCacheDir()()` `https://developer.android.com/reference/java/lang/ClassLoader.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getClassLoader()()` `https://developer.android.com/reference/java/io/File.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getCodeCacheDir()()` `https://developer.android.com/reference/android/content/ContentResolver.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getContentResolver()()` `https://developer.android.com/reference/java/io/File.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getDataDir()()` `https://developer.android.com/reference/java/io/File.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getDatabasePath(java.lang.String)(https://developer.android.com/reference/java/lang/String.html name)` `int` `https://developer.android.com/reference/android/content/ContextWrapper.html#getDeviceId()()` `https://developer.android.com/reference/java/io/File.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getDir(java.lang.String, int)(https://developer.android.com/reference/java/lang/String.html name, int mode)` `https://developer.android.com/reference/android/view/Display.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getDisplay()()` `https://developer.android.com/reference/java/io/File.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getExternalCacheDir()()` `File[]` `https://developer.android.com/reference/android/content/ContextWrapper.html#getExternalCacheDirs()()` `https://developer.android.com/reference/java/io/File.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getExternalFilesDir(java.lang.String)(https://developer.android.com/reference/java/lang/String.html type)` `File[]` `https://developer.android.com/reference/android/content/ContextWrapper.html#getExternalFilesDirs(java.lang.String)(https://developer.android.com/reference/java/lang/String.html type)` `File[]` `https://developer.android.com/reference/android/content/ContextWrapper.html#getExternalMediaDirs()()`

**This method is deprecated.**
`https://developer.android.com/reference/java/io/File.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getFileStreamPath(java.lang.String)(https://developer.android.com/reference/java/lang/String.html name)` `https://developer.android.com/reference/java/io/File.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getFilesDir()()` `https://developer.android.com/reference/java/util/concurrent/Executor.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getMainExecutor()()` `https://developer.android.com/reference/android/os/Looper.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getMainLooper()()` `https://developer.android.com/reference/java/io/File.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getNoBackupFilesDir()()` `https://developer.android.com/reference/java/io/File.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getObbDir()()` `File[]` `https://developer.android.com/reference/android/content/ContextWrapper.html#getObbDirs()()` `https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getOpPackageName()()` `https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getPackageCodePath()()` `https://developer.android.com/reference/android/content/pm/PackageManager.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getPackageManager()()` `https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getPackageName()()` `https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getPackageResourcePath()()` `https://developer.android.com/reference/android/content/ContextParams.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getParams()()` `https://developer.android.com/reference/android/content/res/Resources.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getResources()()` `https://developer.android.com/reference/android/content/SharedPreferences.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getSharedPreferences(java.lang.String, int)(https://developer.android.com/reference/java/lang/String.html name, int mode)` `https://developer.android.com/reference/java/lang/Object.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getSystemService(java.lang.String)(https://developer.android.com/reference/java/lang/String.html name)` `https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getSystemServiceName(java.lang.Class&lt;?&gt;)(https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> serviceClass)` `https://developer.android.com/reference/android/content/res/Resources.Theme.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getTheme()()` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#getWallpaper()()`

**This method is deprecated.**
`int` `https://developer.android.com/reference/android/content/ContextWrapper.html#getWallpaperDesiredMinimumHeight()()`

**This method is deprecated.**
`int` `https://developer.android.com/reference/android/content/ContextWrapper.html#getWallpaperDesiredMinimumWidth()()`

**This method is deprecated.**
`void` `https://developer.android.com/reference/android/content/ContextWrapper.html#grantUriPermission(java.lang.String, android.net.Uri, int)(https://developer.android.com/reference/java/lang/String.html toPackage, https://developer.android.com/reference/android/net/Uri.html uri, int modeFlags)` `boolean` `https://developer.android.com/reference/android/content/ContextWrapper.html#isDeviceProtectedStorage()()` `boolean` `https://developer.android.com/reference/android/content/ContextWrapper.html#isRestricted()()` `boolean` `https://developer.android.com/reference/android/content/ContextWrapper.html#isUiContext()()` `boolean` `https://developer.android.com/reference/android/content/ContextWrapper.html#moveDatabaseFrom(android.content.Context, java.lang.String)(https://developer.android.com/reference/android/content/Context.html sourceContext, https://developer.android.com/reference/java/lang/String.html name)` `boolean` `https://developer.android.com/reference/android/content/ContextWrapper.html#moveSharedPreferencesFrom(android.content.Context, java.lang.String)(https://developer.android.com/reference/android/content/Context.html sourceContext, https://developer.android.com/reference/java/lang/String.html name)` `https://developer.android.com/reference/java/io/FileInputStream.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#openFileInput(java.lang.String)(https://developer.android.com/reference/java/lang/String.html name)` `https://developer.android.com/reference/java/io/FileOutputStream.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#openFileOutput(java.lang.String, int)(https://developer.android.com/reference/java/lang/String.html name, int mode)` `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase.CursorFactory)(
https://developer.android.com/reference/java/lang/String.html name,
int mode,
https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.CursorFactory.html factory
)` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#peekWallpaper()()`

**This method is deprecated.**
`void` `https://developer.android.com/reference/android/content/ContextWrapper.html#rebindService(android.content.ServiceConnection, android.content.Context.BindServiceFlags)(https://developer.android.com/reference/android/content/ServiceConnection.html conn, https://developer.android.com/reference/android/content/Context.BindServiceFlags.html flags)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#registerComponentCallbacks(android.content.ComponentCallbacks)(https://developer.android.com/reference/android/content/ComponentCallbacks.html callback)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#registerDeviceIdChangeListener(java.util.concurrent.Executor, java.util.function.IntConsumer)(https://developer.android.com/reference/java/util/concurrent/Executor.html executor, https://developer.android.com/reference/java/util/function/IntConsumer.html listener)` `https://developer.android.com/reference/android/content/Intent.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter)(https://developer.android.com/reference/android/content/BroadcastReceiver.html receiver, https://developer.android.com/reference/android/content/IntentFilter.html filter)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#removeStickyBroadcast(android.content.Intent)(https://developer.android.com/reference/android/content/Intent.html intent)`

**This method is deprecated.**
`void` `https://developer.android.com/reference/android/content/ContextWrapper.html#removeStickyBroadcastAsUser(android.content.Intent, android.os.UserHandle)(https://developer.android.com/reference/android/content/Intent.html intent, https://developer.android.com/reference/android/os/UserHandle.html user)`

**This method is deprecated.**
`void` `https://developer.android.com/reference/android/content/ContextWrapper.html#revokeSelfPermissionsOnKill(java.util.Collection&lt;java.lang.String&gt;)(https://developer.android.com/reference/java/util/Collection.html<https://developer.android.com/reference/java/lang/String.html> permissions)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#revokeUriPermission(android.net.Uri, int)(https://developer.android.com/reference/android/net/Uri.html uri, int modeFlags)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#sendBroadcast(android.content.Intent)(https://developer.android.com/reference/android/content/Intent.html intent)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#sendBroadcastAsUser(android.content.Intent, android.os.UserHandle)(https://developer.android.com/reference/android/content/Intent.html intent, https://developer.android.com/reference/android/os/UserHandle.html user)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#sendOrderedBroadcast(android.content.Intent, int, java.lang.String, java.lang.String, android.content.BroadcastReceiver, android.os.Handler, java.lang.String, android.os.Bundle, android.os.Bundle)(
https://developer.android.com/reference/android/content/Intent.html intent,
int initialCode,
https://developer.android.com/reference/java/lang/String.html receiverPermission,
https://developer.android.com/reference/java/lang/String.html receiverAppOp,
https://developer.android.com/reference/android/content/BroadcastReceiver.html resultReceiver,
https://developer.android.com/reference/android/os/Handler.html scheduler,
https://developer.android.com/reference/java/lang/String.html initialData,
https://developer.android.com/reference/android/os/Bundle.html initialExtras,
https://developer.android.com/reference/android/os/Bundle.html options
)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#sendOrderedBroadcastAsUser(android.content.Intent, android.os.UserHandle, java.lang.String, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle)(
https://developer.android.com/reference/android/content/Intent.html intent,
https://developer.android.com/reference/android/os/UserHandle.html user,
https://developer.android.com/reference/java/lang/String.html receiverPermission,
https://developer.android.com/reference/android/content/BroadcastReceiver.html resultReceiver,
https://developer.android.com/reference/android/os/Handler.html scheduler,
int initialCode,
https://developer.android.com/reference/java/lang/String.html initialData,
https://developer.android.com/reference/android/os/Bundle.html initialExtras
)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#sendStickyBroadcast(android.content.Intent)(https://developer.android.com/reference/android/content/Intent.html intent)`

**This method is deprecated.**
`void` `https://developer.android.com/reference/android/content/ContextWrapper.html#sendStickyBroadcastAsUser(android.content.Intent, android.os.UserHandle)(https://developer.android.com/reference/android/content/Intent.html intent, https://developer.android.com/reference/android/os/UserHandle.html user)`

**This method is deprecated.**
`void` `https://developer.android.com/reference/android/content/ContextWrapper.html#sendStickyOrderedBroadcast(android.content.Intent, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle)(
https://developer.android.com/reference/android/content/Intent.html intent,
https://developer.android.com/reference/android/content/BroadcastReceiver.html resultReceiver,
https://developer.android.com/reference/android/os/Handler.html scheduler,
int initialCode,
https://developer.android.com/reference/java/lang/String.html initialData,
https://developer.android.com/reference/android/os/Bundle.html initialExtras
)`

**This method is deprecated.**
`void` `https://developer.android.com/reference/android/content/ContextWrapper.html#sendStickyOrderedBroadcastAsUser(android.content.Intent, android.os.UserHandle, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle)(
https://developer.android.com/reference/android/content/Intent.html intent,
https://developer.android.com/reference/android/os/UserHandle.html user,
https://developer.android.com/reference/android/content/BroadcastReceiver.html resultReceiver,
https://developer.android.com/reference/android/os/Handler.html scheduler,
int initialCode,
https://developer.android.com/reference/java/lang/String.html initialData,
https://developer.android.com/reference/android/os/Bundle.html initialExtras
)`

**This method is deprecated.**
`void` `https://developer.android.com/reference/android/content/ContextWrapper.html#setTheme(int)(int resid)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#setWallpaper(android.graphics.Bitmap)(https://developer.android.com/reference/android/graphics/Bitmap.html bitmap)`

**This method is deprecated.**
`void` `https://developer.android.com/reference/android/content/ContextWrapper.html#startActivities(android.content.Intent[])(Intent[] intents)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#startActivity(android.content.Intent)(https://developer.android.com/reference/android/content/Intent.html intent)` `https://developer.android.com/reference/android/content/ComponentName.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#startForegroundService(android.content.Intent)(https://developer.android.com/reference/android/content/Intent.html service)` `boolean` `https://developer.android.com/reference/android/content/ContextWrapper.html#startInstrumentation(android.content.ComponentName, java.lang.String, android.os.Bundle)(
https://developer.android.com/reference/android/content/ComponentName.html className,
https://developer.android.com/reference/java/lang/String.html profileFile,
https://developer.android.com/reference/android/os/Bundle.html arguments
)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int)(
https://developer.android.com/reference/android/content/IntentSender.html intent,
https://developer.android.com/reference/android/content/Intent.html fillInIntent,
int flagsMask,
int flagsValues,
int extraFlags
)` `https://developer.android.com/reference/android/content/ComponentName.html` `https://developer.android.com/reference/android/content/ContextWrapper.html#startService(android.content.Intent)(https://developer.android.com/reference/android/content/Intent.html service)` `boolean` `https://developer.android.com/reference/android/content/ContextWrapper.html#stopService(android.content.Intent)(https://developer.android.com/reference/android/content/Intent.html name)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#unbindService(android.content.ServiceConnection)(https://developer.android.com/reference/android/content/ServiceConnection.html conn)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#unregisterComponentCallbacks(android.content.ComponentCallbacks)(https://developer.android.com/reference/android/content/ComponentCallbacks.html callback)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#unregisterDeviceIdChangeListener(java.util.function.IntConsumer)(https://developer.android.com/reference/java/util/function/IntConsumer.html listener)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#unregisterReceiver(android.content.BroadcastReceiver)(https://developer.android.com/reference/android/content/BroadcastReceiver.html receiver)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#updateServiceBindings(java.util.Collection&lt;android.content.Context.UpdateBindingParams&gt;)(https://developer.android.com/reference/java/util/Collection.html<https://developer.android.com/reference/android/content/Context.UpdateBindingParams.html> params)` `void` `https://developer.android.com/reference/android/content/ContextWrapper.html#updateServiceGroup(android.content.ServiceConnection, int, int)(https://developer.android.com/reference/android/content/ServiceConnection.html conn, int group, int importance)`

## Constants

### ACTION_NAVIGATE

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

```
public static final String ACTION_NAVIGATE = "androidx.car.app.action.NAVIGATE"
```

Standard action for navigating to a location.

Used as the `https://developer.android.com/reference/android/content/Intent.html`'s action for starting a navigation via `https://developer.android.com/reference/androidx/car/app/CarContext#startCarApp(android.content.Intent)`.

### APP_SERVICE

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

```
public static final String APP_SERVICE = "app"
```

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

### CAR_SERVICE

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

```
public static final String CAR_SERVICE = "car"
```

Internal usage only. Top level binder to host.

### CONSTRAINT_SERVICE

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.1.0)

```
@RequiresCarApi(value = 2)
public static final String CONSTRAINT_SERVICE = "constraints"
```

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

### EXTRA_START_CAR_APP_BINDER_KEY

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

```
public static final String EXTRA_START_CAR_APP_BINDER_KEY = "androidx.car.app.extra.START_CAR_APP_BINDER_KEY"
```

Key for including a IStartCarApp in the notification `https://developer.android.com/reference/android/content/Intent.html`, for starting the app if it has not been opened yet.

### HARDWARE_SERVICE

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.1.0)

```
@RequiresCarApi(value = 3)
public static final String HARDWARE_SERVICE = "hardware"
```

Manages access to androidx.car.app.hardware properties, sensors and actions.

### MEDIA_PLAYBACK_SERVICE

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.4.0)

```
@RequiresCarApi(value = 8)
public static final String MEDIA_PLAYBACK_SERVICE = "media_playback"
```

Manages the media requests from 3p apps such as providing a media session token,

### NAVIGATION_SERVICE

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

```
public static final String NAVIGATION_SERVICE = "navigation"
```

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

### SCREEN_SERVICE

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

```
public static final String SCREEN_SERVICE = "screen"
```

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

### SUGGESTION_SERVICE

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.3.0)

```
public static final String SUGGESTION_SERVICE = "suggestion"
```

Manages posting suggestion events

## Public methods

### finishCarApp

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

```
public void finishCarApp()
```

Requests to finish the car app.

Call this when your app is done and should be closed. The `https://developer.android.com/reference/androidx/car/app/Session` corresponding to this `https://developer.android.com/reference/androidx/car/app/CarContext` will become `State.DESTROYED`.

At some point after this call, the OS will destroy your `https://developer.android.com/reference/androidx/car/app/CarAppService`.

**This method should not be called until the `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State` of the context's `https://developer.android.com/reference/androidx/car/app/Session` is at least `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED`**.

### getCallingComponent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.1.0)

```
@RequiresCarApi(value = 2)
public @Nullable ComponentName getCallingComponent()
```

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

This is who the data in `https://developer.android.com/reference/androidx/car/app/CarContext#setCarAppResult(int,android.content.Intent)` will be sent to. You can use this information to validate that the recipient is allowed to receive the data.

**Starting applications for result is not implemented in Android Auto, and this method will always return null for that platform.**

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/content/ComponentName.html` | the `https://developer.android.com/reference/android/content/ComponentName.html` of the component that will receive your reply, or `null` if none |

### getCarAppApiLevel

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

```
public int getCarAppApiLevel()
```

Retrieves the API level negotiated with the host.

API levels are used during client and host connection handshake to negotiate a common set of elements that both processes can understand. Different devices might have different host versions. Each of these hosts will support a range of API levels, as a way to provide backwards compatibility.

Applications can also provide forward compatibility, by declaring support for a `https://developer.android.com/reference/androidx/car/app/AppInfo#getMinCarAppApiLevel()` lower than `https://developer.android.com/reference/androidx/car/app/AppInfo#getLatestCarAppApiLevel()`. See `https://developer.android.com/reference/androidx/car/app/AppInfo#getMinCarAppApiLevel()` for more details.

Clients must ensure no elements annotated with a `https://developer.android.com/reference/androidx/car/app/annotations/RequiresCarApi` value higher than returned by this method is used at runtime.

Refer to `https://developer.android.com/reference/androidx/car/app/annotations/RequiresCarApi` description for more details on how to implement forward compatibility.

**This method should not be called until the `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State` of the context's `https://developer.android.com/reference/androidx/car/app/Session` is at least `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED`**.

Value is one of the following:

- `CarAppApiLevels.UNKNOWN`
- `CarAppApiLevels.LEVEL_1`
- `CarAppApiLevels.LEVEL_2`
- `CarAppApiLevels.LEVEL_3`
- `CarAppApiLevels.LEVEL_4`
- `CarAppApiLevels.LEVEL_5`
- `CarAppApiLevels.LEVEL_6`
- `CarAppApiLevels.LEVEL_7`
- `CarAppApiLevels.LEVEL_8`
- `CarAppApiLevels.LEVEL_9`

<br />

| Returns |
|---|---|
| `int` | a value between `https://developer.android.com/reference/androidx/car/app/AppInfo#getMinCarAppApiLevel()` and `https://developer.android.com/reference/androidx/car/app/AppInfo#getLatestCarAppApiLevel()`. In case of incompatibility, the host will disconnect from the service before completing the handshake |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if invoked before the connection handshake with the host has been completed (for example, before `https://developer.android.com/reference/androidx/car/app/Session#onCreateScreen(android.content.Intent)`) |

### getCarService

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

```
public @NonNull Object getCarService(@NonNull String name)
```

Provides a car service by name.

The class of the returned object varies by the requested name.

Currently supported car services, and their respective classes, are:

`https://developer.android.com/reference/androidx/car/app/CarContext#APP_SERVICE()`

:   An `https://developer.android.com/reference/androidx/car/app/AppManager` for communication between the app and the host.

`https://developer.android.com/reference/androidx/car/app/CarContext#NAVIGATION_SERVICE()`

:   A `https://developer.android.com/reference/androidx/car/app/navigation/NavigationManager` for management of navigation updates.

`https://developer.android.com/reference/androidx/car/app/CarContext#SCREEN_SERVICE()`

:   A `https://developer.android.com/reference/androidx/car/app/ScreenManager` for management of `https://developer.android.com/reference/androidx/car/app/Screen`s.

`https://developer.android.com/reference/androidx/car/app/CarContext#CONSTRAINT_SERVICE()`

:   A `https://developer.android.com/reference/androidx/car/app/constraints/ConstraintManager` for management of content limits.

`https://developer.android.com/reference/androidx/car/app/CarContext#HARDWARE_SERVICE()`

:   A `https://developer.android.com/reference/androidx/car/app/hardware/CarHardwareManager` for interacting with car hardware (e.g. sensors) data.

`https://developer.android.com/reference/androidx/car/app/CarContext#SUGGESTION_SERVICE()`

:   A `https://developer.android.com/reference/androidx/car/app/suggestion/SuggestionManager` for posting `https://developer.android.com/reference/androidx/car/app/suggestion/model/Suggestion`s.

**This method should not be called until the `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State` of the context's `https://developer.android.com/reference/androidx/car/app/Session` is at least `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED`**.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html name` | The name of the car service requested. This should be one of `https://developer.android.com/reference/androidx/car/app/CarContext#APP_SERVICE()`, `https://developer.android.com/reference/androidx/car/app/CarContext#NAVIGATION_SERVICE()` or `https://developer.android.com/reference/androidx/car/app/CarContext#SCREEN_SERVICE()` |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/Object.html` | The car service instance |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if `name` does not refer to a valid car service |
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if the service referred by `name` can not be instantiated (e.g. missing library dependency) |
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `name` is `null` |

### getCarService

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

```
public @NonNull T <T> getCarService(@NonNull Class<T> serviceClass)
```

Returns a car service by class.

See `https://developer.android.com/reference/androidx/car/app/CarContext#getCarService(java.lang.String)` for a list of the supported car services.

**This method should not be called until the `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State` of the context's `https://developer.android.com/reference/androidx/car/app/Session` is at least `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED`**.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/Class.html<T> serviceClass` | the class of the requested service |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if `serviceClass` is not the class of a supported car service |
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if `serviceClass` can not be instantiated (e.g. missing library dependency) |
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `serviceClass` is `null` |

### getCarServiceName

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

```
public @NonNull String getCarServiceName(@NonNull Class<@NonNull ?> serviceClass)
```

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

**This method should not be called until the `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State` of the context's `https://developer.android.com/reference/androidx/car/app/Session` is at least `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED`**.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> serviceClass` | the class of the requested service |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | the car service name to use with `https://developer.android.com/reference/androidx/car/app/CarContext#getCarService(java.lang.String)` |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if `serviceClass` is not the class of a supported car service |
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `serviceClass` is `null` |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/car/app/CarContext#getCarService(java.lang.String)` |   |

### getHostInfo

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.1.0)

```
public @Nullable HostInfo getHostInfo()
```

Returns information about the host attached to this service.

**This method should not be called until the `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State` of the context's `https://developer.android.com/reference/androidx/car/app/Session` is at least `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED`**.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/car/app/HostInfo` | The `https://developer.android.com/reference/androidx/car/app/HostInfo` of the connected host, or `null` if it is not available. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/car/app/HostInfo` |   |

### getOnBackPressedDispatcher

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

```
public @NonNull OnBackPressedDispatcher getOnBackPressedDispatcher()
```

Returns the `https://developer.android.com/reference/androidx/activity/OnBackPressedDispatcher` that will be triggered when the user clicks a back button.

The default back press behavior is to call `https://developer.android.com/reference/androidx/car/app/ScreenManager#pop()`.

To override the default behavior, register a `https://developer.android.com/reference/androidx/activity/OnBackPressedCallback` via calling `https://developer.android.com/reference/androidx/activity/OnBackPressedDispatcher#addCallback(androidx.lifecycle.LifecycleOwner,androidx.activity.OnBackPressedCallback)`. Using the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` ensures that your callback is only registered while its `https://developer.android.com/reference/androidx/lifecycle/Lifecycle` is at least `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#STARTED`.

If there is a `https://developer.android.com/reference/androidx/activity/OnBackPressedCallback` that is added and enabled, and you'd like to remove the top `https://developer.android.com/reference/androidx/car/app/Screen` as a part of the callback, you **MUST** call `https://developer.android.com/reference/androidx/car/app/ScreenManager#pop()` in the callback. The default behavior is overridden when you have a callback enabled.

### isDarkMode

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

```
public boolean isDarkMode()
```

Returns `true` if the car is set to dark mode.

Navigation applications must redraw their map with the proper dark colors when the host determines that conditions warrant it, as signaled by the value returned by this method.

Whenever the dark mode status changes, you will receive a call to `https://developer.android.com/reference/androidx/car/app/Session#onCarConfigurationChanged(android.content.res.Configuration)`.

**This method should not be called until the `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State` of the context's `https://developer.android.com/reference/androidx/car/app/Session` is at least `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED`**.

### requestPermissions

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.1.0)

```
public void requestPermissions(
    @NonNull List<String> permissions,
    @NonNull OnRequestPermissionsListener listener
)
```

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

The app can define a branded background to the permission request through the `carPermissionActivityLayout` theme attribute, by declaring it in a theme and referencing the theme from the `androidx.car.app.theme` metadata.

In `AndroidManifest.xml`, under the `application` element corresponding to the car app:

```
<meta-data
  android:name="androidx.car.app.theme"
  android:resource="@style/CarAppTheme"/>
```
The `CarAppTheme` style is defined as any other themes in a resource file:

```
<resources>
  <style name="CarAppTheme">
    <item name="carPermissionActivityLayout">@layout/app_branded_background</item>
  </style>
</resources>
```

The default behavior is to have no background behind the permission request.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/car/app/CarContext#requestPermissions(java.util.List<java.lang.String>,java.util.concurrent.Executor,androidx.car.app.OnRequestPermissionsListener)` | = |

### requestPermissions

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.1.0)

```
public void requestPermissions(
    @NonNull List<String> permissions,
    @NonNull Executor executor,
    @NonNull OnRequestPermissionsListener listener
)
```

Requests the provided `permissions` from the user.

When the result is available, the `listener` provided will be called using the `https://developer.android.com/reference/java/util/concurrent/Executor.html` provided.

This method should be called using a `https://developer.android.com/reference/androidx/car/app/model/ParkedOnlyOnClickListener`.

If this method is called while the host deems it is unsafe (for example, when the user is driving), the permission(s) will not be requested from the user.

If the `https://developer.android.com/reference/androidx/car/app/Session` is destroyed before the user accepts or rejects the permissions, the callback will not be executed.

#### Platform Considerations

Using this method allows the app to work across all platforms supported by the library with the same API (e.g. Android Auto on mobile devices and Android Automotive OS on native car heads unit). On a mobile platform, this method will start an activity that will display the platform's permissions UI over it. You can choose to not use this method and instead implement your own activity and code to request the permissions in that platform. On Automotive OS however, distraction-optimized activities other than `CarAppActivity` are not allowed and may be rejected during app submission. See `CarAppActivity` for more details.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html> permissions` | the runtime permissions to request from the user |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/concurrent/Executor.html executor` | the executor that will be used for calling the `callback` provided |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/OnRequestPermissionsListener listener` | listener that will be notified when the user takes action on the permission request |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if any of `executor`, `permissions` or `callback` are `null` |

### setCarAppResult

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.1.0)

```
@RequiresCarApi(value = 2)
public void setCarAppResult(int resultCode, @Nullable Intent data)
```

Sets the result of this car app.

In Android Automotive OS, this is equivalent to `https://developer.android.com/reference/android/app/Activity.html#setResult(int, android.content.Intent)`. Call this to set the result that your `CarAppActivity` will return to its caller.

**This method is not implemented in Android Auto.**

| Parameters |
|---|---|
| `int resultCode` | the result code to propagate back to the originating app, often `https://developer.android.com/reference/android/app/Activity.html#RESULT_CANCELED` or `https://developer.android.com/reference/android/app/Activity.html#RESULT_OK` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/content/Intent.html data` | the data to propagate back to the originating app |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if the method is not supported in the current platform. |

### startCarApp

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

```
public void startCarApp(@NonNull Intent intent)
```

Starts a car app on the car screen.

The target application will get the `https://developer.android.com/reference/android/content/Intent.html` via `https://developer.android.com/reference/androidx/car/app/Session#onCreateScreen(android.content.Intent)` or `https://developer.android.com/reference/androidx/car/app/Session#onNewIntent(android.content.Intent)`.

Supported `https://developer.android.com/reference/android/content/Intent.html`s:

An `https://developer.android.com/reference/android/content/Intent.html` to navigate.

:   The action must be `https://developer.android.com/reference/androidx/car/app/CarContext#ACTION_NAVIGATE()`.
:   The data URI scheme must be either a latitude,longitude pair, or a + separated string query as follows:
:   1) "geo:12.345,14.8767" for a latitude, longitude pair.
:   2) "geo:0,0?q=123+Main+St,+Seattle,+WA+98101" for an address.
:   3) "geo:0,0?q=a+place+name" for a place to search for.

An `https://developer.android.com/reference/android/content/Intent.html` to make a phone call.

:   The `https://developer.android.com/reference/android/content/Intent.html` must be created as defined [here](https://developer.android
    .com/guide/components/intents-common#DialPhone).

An `https://developer.android.com/reference/android/content/Intent.html` to start this app in the car.

:   The component name of the intent must be the one for the `https://developer.android.com/reference/androidx/car/app/CarAppService` that contains this `https://developer.android.com/reference/androidx/car/app/CarContext`. If the component name is for a different component, the method will throw a `https://developer.android.com/reference/java/lang/SecurityException.html`.

**This method should not be called until the `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State` of the context's `https://developer.android.com/reference/androidx/car/app/Session` is at least `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED`**.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html intent` | the `https://developer.android.com/reference/android/content/Intent.html` to send to the target application |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/SecurityException.html` | if the app attempts to start a different app explicitly or does not have permissions for the requested action |
| `https://developer.android.com/reference/androidx/car/app/HostException` | if the remote call fails. For example, if the intent cannot be handled by the car host. |
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `intent` is `null` |

### startCarApp

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.1.0)

```
public static void [startCarApp](https://developer.android.com/reference/androidx/car/app/CarContext#startCarApp(android.content.Intent,android.content.Intent))(@NonNull Intent notificationIntent, @NonNull Intent appIntent)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> use `https://developer.android.com/reference/androidx/car/app/notification/CarPendingIntent#getCarApp(android.content.Context,int,android.content.Intent,int)` to create the pending intent for the notification action. This API will NOT work for Automotive OS.

Starts the car app on the car screen.

Use this method if the app has received a broadcast due to a notification action.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html notificationIntent` | the `https://developer.android.com/reference/android/content/Intent.html` that the app received via broadcast due to a user taking an action on a notification in the car |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html appIntent` | the `https://developer.android.com/reference/android/content/Intent.html` to use for starting the car app. See `https://developer.android.com/reference/androidx/car/app/CarContext#startCarApp(android.content.Intent)` for the documentation on valid `https://developer.android.com/reference/android/content/Intent.html`s |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/security/InvalidParameterException.html` | if `notificationIntent` is not an `https://developer.android.com/reference/android/content/Intent.html` received from a broadcast, due to an action taken by the user in the car |
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if either `notificationIntent` or `appIntent ` are `null` |