# 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)

*** ** * ** ***


```
class CarFeatures
```

<br />

*** ** * ** ***

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

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/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. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/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 functions |
|---|---|
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/features/CarFeatures#isFeatureEnabled(android.content.Context,java.lang.String)(context: https://developer.android.com/reference/android/content/Context.html, feature: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` 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)

```
const val FEATURE_BACKGROUND_AUDIO_WHILE_DRIVING = "com.android.car.background_audio_while_driving": String!
```

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)

```
const val FEATURE_CAR_APP_LIBRARY_MEDIA = "android.software.car.templates_host.media": String!
```

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

## Public functions

### isFeatureEnabled

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

```
java-static fun isFeatureEnabled(context: Context, feature: String): Boolean
```

Checks whether the system enables a given CarFeature.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | The context with which to query for the CarFeature. |
| `feature: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The CarFeature to query for. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the system enables a given CarFeature. |