# MediaBrowserServiceCompat.BrowserRoot

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:support-media-compat:28.0.0-alpha1  
Summary:[Constants](https://developer.android.com/reference/android/support/v4-media/MediaBrowserServiceCompat.BrowserRoot#constants)\|[Ctors](https://developer.android.com/reference/android/support/v4-media/MediaBrowserServiceCompat.BrowserRoot#pubctors)\|[Methods](https://developer.android.com/reference/android/support/v4-media/MediaBrowserServiceCompat.BrowserRoot#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v4-media/MediaBrowserServiceCompat.BrowserRoot#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v4-media/MediaBrowserServiceCompat.BrowserRoot#)  

# MediaBrowserServiceCompat.BrowserRoot

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public
static
final

class
MediaBrowserServiceCompat.BrowserRoot
`  
`

extends Object


``


`

|---|----------------------------------------------------------------|
| java.lang.Object                                                  ||
| ↳ | android.support.v4.media.MediaBrowserServiceCompat.BrowserRoot |

<br />

*** ** * ** ***

Contains information that the browser service needs to send to the client when first connected.

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                                                                                    ### Constants                                                                                                                                                                                                                                                                                                                                                                                                                                                     ||
|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `String` | [EXTRA_OFFLINE](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.BrowserRoot#EXTRA_OFFLINE) The lookup key for a boolean that indicates whether the browser service should return a browser root for offline media items.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `String` | [EXTRA_RECENT](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.BrowserRoot#EXTRA_RECENT) The lookup key for a boolean that indicates whether the browser service should return a browser root for recently played media items.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `String` | [EXTRA_SUGGESTED](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.BrowserRoot#EXTRA_SUGGESTED) The lookup key for a boolean that indicates whether the browser service should return a browser root for suggested media items.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `String` | [EXTRA_SUGGESTION_KEYWORDS](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.BrowserRoot#EXTRA_SUGGESTION_KEYWORDS) *This constant was deprecated in API level 25.4.0. The search functionality is now supported by the methods[search(String, Bundle, MediaBrowserCompat.SearchCallback)](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#search(java.lang.String, android.os.Bundle, android.support.v4.media.MediaBrowserCompat.SearchCallback))and[onSearch(String, Bundle, MediaBrowserServiceCompat.Result>)](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat#onSearch(java.lang.String, android.os.Bundle, android.support.v4.media.MediaBrowserServiceCompat.Result<java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>>)). Use those methods instead.* |

|                                                                                                                                                                     ### Public constructors                                                                                                                                                                      ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[MediaBrowserServiceCompat.BrowserRoot](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.BrowserRoot#MediaBrowserServiceCompat.BrowserRoot(java.lang.String, android.os.Bundle))`(String rootId, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` extras) ` Constructs a browser root. |

|                                                                                                                       ### Public methods                                                                                                                        ||
|-----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[Bundle](https://developer.android.com/reference/android/os/Bundle.html) | ` `[getExtras](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.BrowserRoot#getExtras())`() ` Gets any extras about the browser service. |
| ` String`                                                                   | ` `[getRootId](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.BrowserRoot#getRootId())`() ` Gets the root id for browsing.             |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4-media/MediaBrowserServiceCompat.BrowserRoot#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Constants

### EXTRA_OFFLINE

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
String EXTRA_OFFLINE
```

The lookup key for a boolean that indicates whether the browser service should return a browser root for offline media items.

When creating a media browser for a given media browser service, this key can be supplied as a root hint for retrieving media items that are can be played without an internet connection. If the media browser service can provide such media items, the implementation must return the key in the root hint when[onGetRoot(String, int, Bundle)](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat#onGetRoot(java.lang.String, int, android.os.Bundle))is called back.

The root hint may contain multiple keys.

<br />

**See also:**

- [EXTRA_RECENT](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.BrowserRoot#EXTRA_RECENT)
- [EXTRA_SUGGESTED](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.BrowserRoot#EXTRA_SUGGESTED)

Constant Value: "android.service.media.extra.OFFLINE"  

### EXTRA_RECENT

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
String EXTRA_RECENT
```

The lookup key for a boolean that indicates whether the browser service should return a browser root for recently played media items.

When creating a media browser for a given media browser service, this key can be supplied as a root hint for retrieving media items that are recently played. If the media browser service can provide such media items, the implementation must return the key in the root hint when[onGetRoot(String, int, Bundle)](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat#onGetRoot(java.lang.String, int, android.os.Bundle))is called back.

The root hint may contain multiple keys.

<br />

**See also:**

- [EXTRA_OFFLINE](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.BrowserRoot#EXTRA_OFFLINE)
- [EXTRA_SUGGESTED](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.BrowserRoot#EXTRA_SUGGESTED)

Constant Value: "android.service.media.extra.RECENT"  

### EXTRA_SUGGESTED

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
String EXTRA_SUGGESTED
```

The lookup key for a boolean that indicates whether the browser service should return a browser root for suggested media items.

When creating a media browser for a given media browser service, this key can be supplied as a root hint for retrieving the media items suggested by the media browser service. The list of media items passed in[onChildrenLoaded(String, List)](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.SubscriptionCallback#onChildrenLoaded(java.lang.String, java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>))is considered ordered by relevance, first being the top suggestion. If the media browser service can provide such media items, the implementation must return the key in the root hint when[onGetRoot(String, int, Bundle)](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat#onGetRoot(java.lang.String, int, android.os.Bundle))is called back.

The root hint may contain multiple keys.

<br />

**See also:**

- [EXTRA_RECENT](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.BrowserRoot#EXTRA_RECENT)
- [EXTRA_OFFLINE](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.BrowserRoot#EXTRA_OFFLINE)

Constant Value: "android.service.media.extra.SUGGESTED"  

### EXTRA_SUGGESTION_KEYWORDS

added in[version 25.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
String EXTRA_SUGGESTION_KEYWORDS
```

<br />

**This constant was deprecated in API level 25.4.0.**   
The search functionality is now supported by the methods[search(String, Bundle, MediaBrowserCompat.SearchCallback)](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat#search(java.lang.String, android.os.Bundle, android.support.v4.media.MediaBrowserCompat.SearchCallback))and[onSearch(String, Bundle, MediaBrowserServiceCompat.Result>)](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat#onSearch(java.lang.String, android.os.Bundle, android.support.v4.media.MediaBrowserServiceCompat.Result<java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>>)). Use those methods instead.

The lookup key for a string that indicates specific keywords which will be considered when the browser service suggests media items.

When creating a media browser for a given media browser service, this key can be supplied as a root hint together with[EXTRA_SUGGESTED](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.BrowserRoot#EXTRA_SUGGESTED)for retrieving suggested media items related with the keywords. The list of media items passed in[onChildrenLoaded(String, List)](https://developer.android.com/reference/android/media/browse/MediaBrowser.SubscriptionCallback.html#onChildrenLoaded(java.lang.String, java.util.List<android.media.browse.MediaBrowser.MediaItem>))is considered ordered by relevance, first being the top suggestion. If the media browser service can provide such media items, the implementation must return the key in the root hint when[onGetRoot(String, int, Bundle)](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat#onGetRoot(java.lang.String, int, android.os.Bundle))is called back.

The root hint may contain multiple keys.

<br />

**See also:**

- [EXTRA_RECENT](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.BrowserRoot#EXTRA_RECENT)
- [EXTRA_OFFLINE](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.BrowserRoot#EXTRA_OFFLINE)
- [EXTRA_SUGGESTED](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.BrowserRoot#EXTRA_SUGGESTED)

Constant Value: "android.service.media.extra.SUGGESTION_KEYWORDS"

## Public constructors

### MediaBrowserServiceCompat.BrowserRoot

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
MediaBrowserServiceCompat.BrowserRoot (String rootId,
                Bundle extras)
```

Constructs a browser root.

<br />

|                            Parameters                            ||
|----------|--------------------------------------------------------|
| `rootId` | `String`: The root id for browsing. <br />             |
| `extras` | `Bundle`: Any extras about the browser service. <br /> |

## Public methods

### getExtras

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Bundle getExtras ()
```

Gets any extras about the browser service.

<br />

|                                     Returns                                      ||
|--------------------------------------------------------------------------|--------|
| [Bundle](https://developer.android.com/reference/android/os/Bundle.html) | <br /> |

### getRootId

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
String getRootId ()
```

Gets the root id for browsing.

<br />

|     Returns      ||
|----------|--------|
| `String` | <br /> |

-

  ## Classes

  - [AudioAttributesCompat](https://developer.android.com/reference/android/support/v4/media/AudioAttributesCompat)
  - [AudioAttributesCompat.Builder](https://developer.android.com/reference/android/support/v4/media/AudioAttributesCompat.Builder)
  - [MediaBrowserCompat](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat)
  - [MediaBrowserCompat.ConnectionCallback](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.ConnectionCallback)
  - [MediaBrowserCompat.CustomActionCallback](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.CustomActionCallback)
  - [MediaBrowserCompat.ItemCallback](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.ItemCallback)
  - [MediaBrowserCompat.MediaItem](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.MediaItem)
  - [MediaBrowserCompat.SearchCallback](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.SearchCallback)
  - [MediaBrowserCompat.SubscriptionCallback](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.SubscriptionCallback)
  - [MediaBrowserServiceCompat](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat)
  - [MediaBrowserServiceCompat.BrowserRoot](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.BrowserRoot)
  - [MediaBrowserServiceCompat.Result](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.Result)
  - [MediaDescriptionCompat](https://developer.android.com/reference/android/support/v4/media/MediaDescriptionCompat)
  - [MediaDescriptionCompat.Builder](https://developer.android.com/reference/android/support/v4/media/MediaDescriptionCompat.Builder)
  - [MediaMetadataCompat](https://developer.android.com/reference/android/support/v4/media/MediaMetadataCompat)
  - [MediaMetadataCompat.Builder](https://developer.android.com/reference/android/support/v4/media/MediaMetadataCompat.Builder)
  - [RatingCompat](https://developer.android.com/reference/android/support/v4/media/RatingCompat)
  - [VolumeProviderCompat](https://developer.android.com/reference/android/support/v4/media/VolumeProviderCompat)
  - [VolumeProviderCompat.Callback](https://developer.android.com/reference/android/support/v4/media/VolumeProviderCompat.Callback)