# CarFeatures

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/features/CarFeatures.java+class:androidx.car.app.features.CarFeatures) Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.7.0)

*** ** * ** ***


```
public final class CarFeatures
```

<br />

*** ** * ** ***

Class for checking for whether car related features are available on the system.

## Summary

| ### Constants |
|---|---|
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/car/app/features/CarFeatures#FEATURE_BACKGROUND_AUDIO_WHILE_DRIVING() = "com.android.car.background_audio_while_driving"` Flag value to check whether or not audio is allowed to play while driving. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/car/app/features/CarFeatures#FEATURE_CAR_APP_LIBRARY_MEDIA() = "android.software.car.templates_host.media"` Flag value to check whether the system supports apps that use the CarAppLibrary Media category |

| ### Public methods |
|---|---|
| `static boolean` | `https://developer.android.com/reference/androidx/car/app/features/CarFeatures#isFeatureEnabled(android.content.Context,java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html feature)` Checks whether the system enables a given CarFeature. |

## Constants

### FEATURE_BACKGROUND_AUDIO_WHILE_DRIVING

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

```
public static final String FEATURE_BACKGROUND_AUDIO_WHILE_DRIVING = "com.android.car.background_audio_while_driving"
```

Flag value to check whether or not audio is allowed to play while driving.

### FEATURE_CAR_APP_LIBRARY_MEDIA

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

```
public static final String FEATURE_CAR_APP_LIBRARY_MEDIA = "android.software.car.templates_host.media"
```

Flag value to check whether the system supports apps that use the CarAppLibrary Media category

## Public methods

### isFeatureEnabled

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

```
public static boolean isFeatureEnabled(@NonNull Context context, @NonNull String feature)
```

Checks whether the system enables a given CarFeature.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | The context with which to query for the CarFeature. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html feature` | The CarFeature to query for. |

| Returns |
|---|---|
| `boolean` | Whether the system enables a given CarFeature. |