# MediaBrowserCompat

Artifact: [androidx.media:media](https://developer.android.com/jetpack/androidx/releases/media) [View Source](https://cs.android.com/search?q=file:android/support/v4/media/MediaBrowserCompat.java+class:android.support.v4.media.MediaBrowserCompat) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

*** ** * ** ***


```
public final class MediaBrowserCompat
```

<br />

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
>
> androidx.media is deprecated. Please migrate to [androidx.media3](https://developer.android.com/media/media3).

Browses media content offered by a `https://developer.android.com/reference/androidx/media/MediaBrowserServiceCompat`.

The app targeting API level 30 or higher must include a `<queries>` element in their manifest to connect to a media browser service in another app. See the following example and [this guide](https://developer.android.com/training/package-visibility) for more information.

```
<!-- As an intent action -->
<intent>
  <action android:name="android.media.browse.MediaBrowserService" />
</intent>
<!-- Or, as a package name -->
<package android:name="package_name_of_the_other_app" />
```

This object is not thread-safe. All calls should happen on the thread on which the browser was constructed. All callback methods will be called from the thread on which the browser was constructed.

## Summary

| ### Nested types |
|---|
| `public class https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.ConnectionCallback` **This class is deprecated.** androidx.media is deprecated. <br /> |
| `public abstract class https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.CustomActionCallback` **This class is deprecated.** androidx.media is deprecated. <br /> |
| `public abstract class https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.ItemCallback` **This class is deprecated.** androidx.media is deprecated. <br /> |
| `public class https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.MediaItem implements https://developer.android.com/reference/android/os/Parcelable.html` **This class is deprecated.** androidx.media is deprecated. <br /> |
| `public abstract class https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.SearchCallback` **This class is deprecated.** androidx.media is deprecated. <br /> |
| `public abstract class https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.SubscriptionCallback` **This class is deprecated.** androidx.media is deprecated. <br /> |

| ### Constants |
|---|---|
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#CUSTOM_ACTION_DOWNLOAD() = "android.support.v4.media.action.DOWNLOAD"` **This field is deprecated.** Deprecated in Java |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#CUSTOM_ACTION_REMOVE_DOWNLOADED_FILE() = "android.support.v4.media.action.REMOVE_DOWNLOADED_FILE"` **This field is deprecated.** Deprecated in Java |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#EXTRA_DOWNLOAD_PROGRESS() = "android.media.browse.extra.DOWNLOAD_PROGRESS"` **This field is deprecated.** Deprecated in Java |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#EXTRA_MEDIA_ID() = "android.media.browse.extra.MEDIA_ID"` **This field is deprecated.** Deprecated in Java |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#EXTRA_PAGE() = "android.media.browse.extra.PAGE"` **This field is deprecated.** Deprecated in Java |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#EXTRA_PAGE_SIZE() = "android.media.browse.extra.PAGE_SIZE"` **This field is deprecated.** Deprecated in Java |

| ### Public constructors |
|---|
| `[MediaBrowserCompat](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#MediaBrowserCompat(android.content.Context,android.content.ComponentName,android.support.v4.media.MediaBrowserCompat.ConnectionCallback,android.os.Bundle))( https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/android/content/ComponentName.html serviceComponent, https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.ConnectionCallback callback, https://developer.android.com/reference/android/os/Bundle.html rootHints )` **This method is deprecated.** Deprecated in Java |

| ### Public methods |
|---|---|
| `void` | `[connect](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#connect())()` **This method is deprecated.** Deprecated in Java |
| `void` | `[disconnect](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#disconnect())()` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html` | `[getExtras](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#getExtras())()` **This method is deprecated.** Deprecated in Java |
| `void` | `[getItem](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#getItem(java.lang.String,android.support.v4.media.MediaBrowserCompat.ItemCallback))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html mediaId, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.ItemCallback cb )` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `[getRoot](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#getRoot())()` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/ComponentName.html` | `[getServiceComponent](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#getServiceComponent())()` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat.Token` | `[getSessionToken](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#getSessionToken())()` **This method is deprecated.** Deprecated in Java |
| `boolean` | `[isConnected](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#isConnected())()` **This method is deprecated.** Deprecated in Java |
| `void` | `[search](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#search(java.lang.String,android.os.Bundle,android.support.v4.media.MediaBrowserCompat.SearchCallback))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html query, https://developer.android.com/reference/android/os/Bundle.html extras, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.SearchCallback callback )` **This method is deprecated.** Deprecated in Java |
| `void` | `[sendCustomAction](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#sendCustomAction(java.lang.String,android.os.Bundle,android.support.v4.media.MediaBrowserCompat.CustomActionCallback))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html action, https://developer.android.com/reference/android/os/Bundle.html extras, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.CustomActionCallback callback )` **This method is deprecated.** Deprecated in Java |
| `void` | `[subscribe](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#subscribe(java.lang.String,android.support.v4.media.MediaBrowserCompat.SubscriptionCallback))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html parentId, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.SubscriptionCallback callback )` **This method is deprecated.** Deprecated in Java |
| `void` | `[subscribe](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#subscribe(java.lang.String,android.os.Bundle,android.support.v4.media.MediaBrowserCompat.SubscriptionCallback))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html parentId, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html options, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.SubscriptionCallback callback )` **This method is deprecated.** Deprecated in Java |
| `void` | `[unsubscribe](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#unsubscribe(java.lang.String))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html parentId)` **This method is deprecated.** Deprecated in Java |
| `void` | `[unsubscribe](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#unsubscribe(java.lang.String,android.support.v4.media.MediaBrowserCompat.SubscriptionCallback))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html parentId, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.SubscriptionCallback callback )` **This method is deprecated.** Deprecated in Java |

## Constants

### CUSTOM_ACTION_DOWNLOAD

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public static final String CUSTOM_ACTION_DOWNLOAD = "android.support.v4.media.action.DOWNLOAD"
```

> [!CAUTION]
> **This field is deprecated.**   
> Deprecated in Java

Predefined custom action to ask the connected service to download a specific `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.MediaItem` for offline playback. The id of the media item must be passed in an extra bundle. The download progress might be delivered to the browser via `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.CustomActionCallback#onProgressUpdate(java.lang.String,android.os.Bundle,android.os.Bundle)`.

| See also |
|---|---|
| `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#EXTRA_MEDIA_ID()` |   |
| `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#EXTRA_DOWNLOAD_PROGRESS()` |   |
| `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#CUSTOM_ACTION_REMOVE_DOWNLOADED_FILE()` |   |

### CUSTOM_ACTION_REMOVE_DOWNLOADED_FILE

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public static final String CUSTOM_ACTION_REMOVE_DOWNLOADED_FILE = "android.support.v4.media.action.REMOVE_DOWNLOADED_FILE"
```

> [!CAUTION]
> **This field is deprecated.**   
> Deprecated in Java

Predefined custom action to ask the connected service to remove the downloaded file of `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.MediaItem` by the `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#CUSTOM_ACTION_DOWNLOAD()` action. The id of the media item must be passed in an extra bundle.

| See also |
|---|---|
| `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#EXTRA_MEDIA_ID()` |   |
| `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#CUSTOM_ACTION_DOWNLOAD()` |   |

### EXTRA_DOWNLOAD_PROGRESS

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public static final String EXTRA_DOWNLOAD_PROGRESS = "android.media.browse.extra.DOWNLOAD_PROGRESS"
```

> [!CAUTION]
> **This field is deprecated.**   
> Deprecated in Java

Used as a float extra field to denote the current progress during download. The value of this field must be a float number within \[0.0, 1.0\].

| See also |
|---|---|
| `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#CUSTOM_ACTION_DOWNLOAD()` |   |
| `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.CustomActionCallback#onProgressUpdate(java.lang.String,android.os.Bundle,android.os.Bundle)` |   |

### EXTRA_MEDIA_ID

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public static final String EXTRA_MEDIA_ID = "android.media.browse.extra.MEDIA_ID"
```

> [!CAUTION]
> **This field is deprecated.**   
> Deprecated in Java

Used as a string extra field to denote the target `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.MediaItem`.

| See also |
|---|---|
| `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#CUSTOM_ACTION_DOWNLOAD()` |   |
| `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#CUSTOM_ACTION_REMOVE_DOWNLOADED_FILE()` |   |

### EXTRA_PAGE

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public static final String EXTRA_PAGE = "android.media.browse.extra.PAGE"
```

> [!CAUTION]
> **This field is deprecated.**   
> Deprecated in Java

Used as an int extra field to denote the page number to subscribe. The value of `EXTRA_PAGE` should be greater than or equal to 0.

| See also |
|---|---|
| `https://developer.android.com/reference/android/service/media/MediaBrowserService.BrowserRoot.html` |   |
| `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#EXTRA_PAGE_SIZE()` |   |

### EXTRA_PAGE_SIZE

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public static final String EXTRA_PAGE_SIZE = "android.media.browse.extra.PAGE_SIZE"
```

> [!CAUTION]
> **This field is deprecated.**   
> Deprecated in Java

Used as an int extra field to denote the number of media items in a page. The value of `EXTRA_PAGE_SIZE` should be greater than or equal to 1.

| See also |
|---|---|
| `https://developer.android.com/reference/android/service/media/MediaBrowserService.BrowserRoot.html` |   |
| `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#EXTRA_PAGE()` |   |

## Public constructors

### MediaBrowserCompat

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public [MediaBrowserCompat](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#MediaBrowserCompat(android.content.Context,android.content.ComponentName,android.support.v4.media.MediaBrowserCompat.ConnectionCallback,android.os.Bundle))(
    Context context,
    ComponentName serviceComponent,
    MediaBrowserCompat.ConnectionCallback callback,
    Bundle rootHints
)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Creates a media browser for the specified media browse service.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/content/Context.html context` | The context. |
| `https://developer.android.com/reference/android/content/ComponentName.html serviceComponent` | The component name of the media browse service. |
| `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.ConnectionCallback callback` | The connection callback. |
| `https://developer.android.com/reference/android/os/Bundle.html rootHints` | An optional bundle of service-specific arguments to send to the media browse service when connecting and retrieving the root id for browsing, or null if none. The contents of this bundle may affect the information returned when browsing. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media/MediaBrowserServiceCompat.BrowserRoot#EXTRA_RECENT()` |   |
| `https://developer.android.com/reference/androidx/media/MediaBrowserServiceCompat.BrowserRoot#EXTRA_OFFLINE()` |   |
| `https://developer.android.com/reference/androidx/media/MediaBrowserServiceCompat.BrowserRoot#EXTRA_SUGGESTED()` |   |

## Public methods

### connect

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public void [connect](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#connect())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Connects to the media browse service. Internally, it binds to the service.

The connection callback specified in the constructor will be invoked when the connection completes or fails.

### disconnect

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public void [disconnect](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#disconnect())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Disconnects from the media browse service. After this, no more callbacks will be received.

### getExtras

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public @Nullable Bundle [getExtras](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#getExtras())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Gets any extras for the media service.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html` | The extra bundle if it is connected and set, and `null` otherwise. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if not connected. |

### getItem

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public void [getItem](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#getItem(java.lang.String,android.support.v4.media.MediaBrowserCompat.ItemCallback))(
    @NonNull String mediaId,
    @NonNull MediaBrowserCompat.ItemCallback cb
)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Retrieves a specific `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.MediaItem` from the connected service. Not all services may support this, so falling back to subscribing to the parent's id should be used when unavailable.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html mediaId` | The id of the item to retrieve. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.ItemCallback cb` | The callback to receive the result on. |

### getRoot

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public @NonNull String [getRoot](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#getRoot())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Gets the root id.

Note that the root id may become invalid or change when when the browser is disconnected.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if not connected. |

### getServiceComponent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public @NonNull ComponentName [getServiceComponent](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#getServiceComponent())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Gets the service component that the media browser is connected to.

### getSessionToken

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public @NonNull MediaSessionCompat.Token [getSessionToken](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#getSessionToken())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Gets the media session token associated with the media browser.

Note that the session token may become invalid or change when when the browser is disconnected.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat.Token` | The session token for the browser, never null. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if not connected. |

### isConnected

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public boolean [isConnected](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#isConnected())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Returns whether the browser is connected to the service.

### search

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public void [search](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#search(java.lang.String,android.os.Bundle,android.support.v4.media.MediaBrowserCompat.SearchCallback))(
    @NonNull String query,
    Bundle extras,
    @NonNull MediaBrowserCompat.SearchCallback callback
)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Searches `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.MediaItem` from the connected service. Not all services may support this, and `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.SearchCallback#onError(java.lang.String,android.os.Bundle)` will be called if not implemented.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html query` | The search query that contains keywords separated by space. Should not be an empty string. |
| `https://developer.android.com/reference/android/os/Bundle.html extras` | The bundle of service-specific arguments to send to the media browser service. The contents of this bundle may affect the search result. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.SearchCallback callback` | The callback to receive the search result. Must be non-null. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if the browser is not connected to the media browser service. |

### sendCustomAction

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public void [sendCustomAction](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#sendCustomAction(java.lang.String,android.os.Bundle,android.support.v4.media.MediaBrowserCompat.CustomActionCallback))(
    @NonNull String action,
    Bundle extras,
    @Nullable MediaBrowserCompat.CustomActionCallback callback
)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Sends a custom action to the connected service. If the service doesn't support the given action, `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.CustomActionCallback#onError(java.lang.String,android.os.Bundle,android.os.Bundle)` will be called.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html action` | The custom action that will be sent to the connected service. Should not be an empty string. |
| `https://developer.android.com/reference/android/os/Bundle.html extras` | The bundle of service-specific arguments to send to the media browser service. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.CustomActionCallback callback` | The callback to receive the result of the custom action. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#CUSTOM_ACTION_DOWNLOAD()` |   |
| `https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#CUSTOM_ACTION_REMOVE_DOWNLOADED_FILE()` |   |

### subscribe

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public void [subscribe](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#subscribe(java.lang.String,android.support.v4.media.MediaBrowserCompat.SubscriptionCallback))(
    @NonNull String parentId,
    @NonNull MediaBrowserCompat.SubscriptionCallback callback
)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Queries for information about the media items that are contained within the specified id and subscribes to receive updates when they change.

The list of subscriptions is maintained even when not connected and is restored after the reconnection. It is ok to subscribe while not connected but the results will not be returned until the connection completes.

If the id is already subscribed with a different callback then the new callback will replace the previous one and the child data will be reloaded.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html parentId` | The id of the parent media item whose list of children will be subscribed. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.SubscriptionCallback callback` | The callback to receive the list of children. |

### subscribe

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public void [subscribe](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#subscribe(java.lang.String,android.os.Bundle,android.support.v4.media.MediaBrowserCompat.SubscriptionCallback))(
    @NonNull String parentId,
    @NonNull Bundle options,
    @NonNull MediaBrowserCompat.SubscriptionCallback callback
)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Queries with service-specific arguments for information about the media items that are contained within the specified id and subscribes to receive updates when they change.

The list of subscriptions is maintained even when not connected and is restored after the reconnection. It is ok to subscribe while not connected but the results will not be returned until the connection completes.

If the id is already subscribed with a different callback then the new callback will replace the previous one and the child data will be reloaded.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html parentId` | The id of the parent media item whose list of children will be subscribed. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html options` | A bundle of service-specific arguments to send to the media browse service. The contents of this bundle may affect the information returned when browsing. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.SubscriptionCallback callback` | The callback to receive the list of children. |

### unsubscribe

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public void [unsubscribe](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#unsubscribe(java.lang.String))(@NonNull String parentId)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Unsubscribes for changes to the children of the specified media id.

The query callback will no longer be invoked for results associated with this id once this method returns.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html parentId` | The id of the parent media item whose list of children will be unsubscribed. |

### unsubscribe

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public void [unsubscribe](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#unsubscribe(java.lang.String,android.support.v4.media.MediaBrowserCompat.SubscriptionCallback))(
    @NonNull String parentId,
    @NonNull MediaBrowserCompat.SubscriptionCallback callback
)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Unsubscribes for changes to the children of the specified media id.

The query callback will no longer be invoked for results associated with this id once this method returns.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html parentId` | The id of the parent media item whose list of children will be unsubscribed. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.SubscriptionCallback callback` | A callback sent to the media browse service to subscribe. |