# MediaBrowserService.BrowserRoot

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Constants](https://developer.android.com/reference/android/service/media/MediaBrowserService.BrowserRoot#constants)\|[Ctors](https://developer.android.com/reference/android/service/media/MediaBrowserService.BrowserRoot#pubctors)\|[Methods](https://developer.android.com/reference/android/service/media/MediaBrowserService.BrowserRoot#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/service/media/MediaBrowserService.BrowserRoot#inhmethods)  

# MediaBrowserService.BrowserRoot

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/service/media/MediaBrowserService.BrowserRoot "View this page in Kotlin")\|Java

`
public
static
final

class
MediaBrowserService.BrowserRoot
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|-------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.service.media.MediaBrowserService.BrowserRoot |

<br />

*** ** * ** ***

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

## Summary

|                                                                                                                                                            ### Constants                                                                                                                                                             ||
|--------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_OFFLINE](https://developer.android.com/reference/android/service/media/MediaBrowserService.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](https://developer.android.com/reference/java/lang/String) | [EXTRA_RECENT](https://developer.android.com/reference/android/service/media/MediaBrowserService.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](https://developer.android.com/reference/java/lang/String) | [EXTRA_SUGGESTED](https://developer.android.com/reference/android/service/media/MediaBrowserService.BrowserRoot#EXTRA_SUGGESTED) The lookup key for a boolean that indicates whether the browser service should return a browser root for suggested media items. |

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

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

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Constants

### EXTRA_OFFLINE

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final 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[MediaBrowserService.onGetRoot(java.lang.String, int, android.os.Bundle)](https://developer.android.com/reference/android/service/media/MediaBrowserService#onGetRoot(java.lang.String,%20int,%20android.os.Bundle))is called back.

The root hint may contain multiple keys.

<br />

**See also:**

- [EXTRA_RECENT](https://developer.android.com/reference/android/service/media/MediaBrowserService.BrowserRoot#EXTRA_RECENT)
- [EXTRA_SUGGESTED](https://developer.android.com/reference/android/service/media/MediaBrowserService.BrowserRoot#EXTRA_SUGGESTED)

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

### EXTRA_RECENT

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final 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[MediaBrowserService.onGetRoot(java.lang.String, int, android.os.Bundle)](https://developer.android.com/reference/android/service/media/MediaBrowserService#onGetRoot(java.lang.String,%20int,%20android.os.Bundle))is called back.

The root hint may contain multiple keys.

<br />

**See also:**

- [EXTRA_OFFLINE](https://developer.android.com/reference/android/service/media/MediaBrowserService.BrowserRoot#EXTRA_OFFLINE)
- [EXTRA_SUGGESTED](https://developer.android.com/reference/android/service/media/MediaBrowserService.BrowserRoot#EXTRA_SUGGESTED)

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

### EXTRA_SUGGESTED

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final 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[MediaBrowser.SubscriptionCallback.onChildrenLoaded(String, List)](https://developer.android.com/reference/android/media/browse/MediaBrowser.SubscriptionCallback#onChildrenLoaded(java.lang.String,%20java.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[MediaBrowserService.onGetRoot(java.lang.String, int, android.os.Bundle)](https://developer.android.com/reference/android/service/media/MediaBrowserService#onGetRoot(java.lang.String,%20int,%20android.os.Bundle))is called back.

The root hint may contain multiple keys.

<br />

**See also:**

- [EXTRA_RECENT](https://developer.android.com/reference/android/service/media/MediaBrowserService.BrowserRoot#EXTRA_RECENT)
- [EXTRA_OFFLINE](https://developer.android.com/reference/android/service/media/MediaBrowserService.BrowserRoot#EXTRA_OFFLINE)

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

## Public constructors

### BrowserRoot

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public BrowserRoot (String rootId, 
                Bundle extras)
```

Constructs a browser root.

<br />

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

## Public methods

### getExtras

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Bundle getExtras ()
```

Gets any extras about the browser service.

<br />

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

### getRootId

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String getRootId ()
```

Gets the root id for browsing.

<br />

|                                  Returns                                   ||
|--------------------------------------------------------------------|--------|
| [String](https://developer.android.com/reference/java/lang/String) | <br /> |