# MediaIntentExtras

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

*** ** * ** ***


```
class MediaIntentExtras
```

<br />

*** ** * ** ***

Defines constants for action and extra keys for CarMediaApp.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#ACTION_MEDIA_TEMPLATE_V2() = "androidx.car.app.mediaextensions.action.MEDIA_TEMPLATE_V2"` Activity Action: Provide media playing through a media template app. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#EXTRA_KEY_MEDIA_COMPONENT() = "android.car.intent.extra.MEDIA_COMPONENT"` `https://developer.android.com/reference/android/os/Bundle.html` key used as a string extra field with `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#ACTION_MEDIA_TEMPLATE_V2()` to specify the MediaBrowserService that user wants to start the media on. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#EXTRA_KEY_MEDIA_ID() = "androidx.car.app.mediaextensions.extra.KEY_MEDIA_ID"` `https://developer.android.com/reference/android/os/Bundle.html` key used as a string extra field with `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#ACTION_MEDIA_TEMPLATE_V2()` to specify the media item that should be displayed in the browse view. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#EXTRA_KEY_SEARCH_ACTION() = "androidx.car.app.mediaextensions.extra.KEY_SEARCH_ACTION"` `https://developer.android.com/reference/android/os/Bundle.html` key used as an int extra field with `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#ACTION_MEDIA_TEMPLATE_V2()` to specify the action for the Media Center to do after the search query is loaded. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#EXTRA_KEY_SEARCH_QUERY() = "android.car.media.extra.SEARCH_QUERY"` `https://developer.android.com/reference/android/os/Bundle.html` key used as a string extra field with `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#ACTION_MEDIA_TEMPLATE_V2()` to specify the search query to send either to the current MediaBrowserService or the one specified with `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#EXTRA_KEY_MEDIA_COMPONENT()`. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#EXTRA_VALUE_NO_SEARCH_ACTION() = 0` The extra value to indicate that no further action will be taken after the search results are loaded from a search query. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#EXTRA_VALUE_PLAY_FIRST_ITEM_FROM_SEARCH() = 1` The extra value to indicate that the first playable item will automatically be played from the displayed search results after a search query is done. |

## Constants

### ACTION_MEDIA_TEMPLATE_V2

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

```
const val ACTION_MEDIA_TEMPLATE_V2 = "androidx.car.app.mediaextensions.action.MEDIA_TEMPLATE_V2": String!
```

Activity Action: Provide media playing through a media template app. The usage is the same as [ACTION_MEDIA_TEMPLATE](https://developer.android.com/reference/android/car/media/CarMediaIntents#ACTION_MEDIA_TEMPLATE) A V2 is provided so that the media apps can know whether the system they run on supports the new parameters.

Input: these optional extras

- `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#EXTRA_KEY_MEDIA_COMPONENT()`
- `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#EXTRA_KEY_MEDIA_ID()`
- `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#EXTRA_KEY_SEARCH_QUERY()`
- `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#EXTRA_KEY_SEARCH_ACTION()`
If no extra is specified, the current media source is opened.

### EXTRA_KEY_MEDIA_COMPONENT

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

```
const val EXTRA_KEY_MEDIA_COMPONENT = "android.car.intent.extra.MEDIA_COMPONENT": String!
```

`https://developer.android.com/reference/android/os/Bundle.html` key used as a string extra field with `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#ACTION_MEDIA_TEMPLATE_V2()` to specify the MediaBrowserService that user wants to start the media on.

TYPE: String. The value of this extra is the same as the [EXTRA_MEDIA_COMPONENT](https://developer.android.com/reference/android/car/media/CarMediaIntents#EXTRA_MEDIA_COMPONENT) for easy access for 3P developers.

### EXTRA_KEY_MEDIA_ID

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

```
const val EXTRA_KEY_MEDIA_ID = "androidx.car.app.mediaextensions.extra.KEY_MEDIA_ID": String!
```

`https://developer.android.com/reference/android/os/Bundle.html` key used as a string extra field with `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#ACTION_MEDIA_TEMPLATE_V2()` to specify the media item that should be displayed in the browse view. Must match the ids used in the MediaBrowserServiceCompat api.

TYPE: String.

### EXTRA_KEY_SEARCH_ACTION

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

```
const val EXTRA_KEY_SEARCH_ACTION = "androidx.car.app.mediaextensions.extra.KEY_SEARCH_ACTION": String!
```

`https://developer.android.com/reference/android/os/Bundle.html` key used as an int extra field with `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#ACTION_MEDIA_TEMPLATE_V2()` to specify the action for the Media Center to do after the search query is loaded.

TYPE: int. The value will be one of the following: `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#EXTRA_VALUE_NO_SEARCH_ACTION()`, `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#EXTRA_VALUE_PLAY_FIRST_ITEM_FROM_SEARCH()`, This extra should only be used together with `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#EXTRA_KEY_SEARCH_QUERY()`. If this extra is not specified, then no further action will be taken after the search results are loaded.

### EXTRA_KEY_SEARCH_QUERY

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

```
const val EXTRA_KEY_SEARCH_QUERY = "android.car.media.extra.SEARCH_QUERY": String!
```

`https://developer.android.com/reference/android/os/Bundle.html` key used as a string extra field with `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#ACTION_MEDIA_TEMPLATE_V2()` to specify the search query to send either to the current MediaBrowserService or the one specified with `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#EXTRA_KEY_MEDIA_COMPONENT()`.

TYPE: String. The value of this extra is the same as the [EXTRA_SEARCH_QUERY](https://developer.android.com/reference/android/car/media/CarMediaIntents#EXTRA_SEARCH_QUERY) for easy access for 3P developers.

### EXTRA_VALUE_NO_SEARCH_ACTION

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

```
const val EXTRA_VALUE_NO_SEARCH_ACTION = 0: Int
```

The extra value to indicate that no further action will be taken after the search results are loaded from a search query. Used with `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#EXTRA_KEY_SEARCH_QUERY()`.

### EXTRA_VALUE_PLAY_FIRST_ITEM_FROM_SEARCH

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

```
const val EXTRA_VALUE_PLAY_FIRST_ITEM_FROM_SEARCH = 1: Int
```

The extra value to indicate that the first playable item will automatically be played from the displayed search results after a search query is done. Used with `https://developer.android.com/reference/kotlin/androidx/car/app/mediaextensions/MediaIntentExtras#EXTRA_KEY_SEARCH_QUERY()`.