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

# BrowserRoot

*** ** * ** ***

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

```
class BrowserRoot
```

|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||
| ↳ | [android.service.media.MediaBrowserService.BrowserRoot](https://developer.android.com/reference/kotlin/android/service/media/MediaBrowserService.BrowserRoot#) |

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

## Summary

| Constants ||
|---|---|
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/service/media/MediaBrowserService.BrowserRoot#EXTRA_OFFLINE:kotlin.String` The lookup key for a boolean that indicates whether the browser service should return a browser root for offline media items. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/service/media/MediaBrowserService.BrowserRoot#EXTRA_RECENT:kotlin.String` The lookup key for a boolean that indicates whether the browser service should return a browser root for recently played media items. |
| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | `https://developer.android.com/reference/kotlin/android/service/media/MediaBrowserService.BrowserRoot#EXTRA_SUGGESTED:kotlin.String` The lookup key for a boolean that indicates whether the browser service should return a browser root for suggested media items. |

| Public constructors ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/service/media/MediaBrowserService.BrowserRoot#BrowserRoot(kotlin.String,%20android.os.Bundle)(rootId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, extras: https://developer.android.com/reference/kotlin/android/os/Bundle.html#?)` Constructs a browser root. |

| Public methods ||
|---|---|
| [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)! | `https://developer.android.com/reference/kotlin/android/service/media/MediaBrowserService.BrowserRoot#getExtras()()` Gets any extras about the browser service. |
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | `https://developer.android.com/reference/kotlin/android/service/media/MediaBrowserService.BrowserRoot#getRootId()()` Gets the root id for browsing. |

## Constants

### EXTRA_OFFLINE

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

```
static val EXTRA_OFFLINE: String
```

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 `https://developer.android.com/reference/kotlin/android/service/media/MediaBrowserService#onGetRoot(kotlin.String,%20kotlin.Int,%20android.os.Bundle)` is called back.

The root hint may contain multiple keys.

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

**See Also**

- `https://developer.android.com/reference/kotlin/android/service/media/MediaBrowserService.BrowserRoot#EXTRA_RECENT:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/service/media/MediaBrowserService.BrowserRoot#EXTRA_SUGGESTED:kotlin.String`

### EXTRA_RECENT

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

```
static val EXTRA_RECENT: String
```

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 `https://developer.android.com/reference/kotlin/android/service/media/MediaBrowserService#onGetRoot(kotlin.String,%20kotlin.Int,%20android.os.Bundle)` is called back.

The root hint may contain multiple keys.

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

**See Also**

- `https://developer.android.com/reference/kotlin/android/service/media/MediaBrowserService.BrowserRoot#EXTRA_OFFLINE:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/service/media/MediaBrowserService.BrowserRoot#EXTRA_SUGGESTED:kotlin.String`

### EXTRA_SUGGESTED

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

```
static val EXTRA_SUGGESTED: String
```

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 `https://developer.android.com/reference/kotlin/android/media/browse/MediaBrowser.SubscriptionCallback.html#onChildrenLoaded(kotlin.String,%20kotlin.collections.MutableList)` 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 `https://developer.android.com/reference/kotlin/android/service/media/MediaBrowserService#onGetRoot(kotlin.String,%20kotlin.Int,%20android.os.Bundle)` is called back.

The root hint may contain multiple keys.

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

**See Also**

- `https://developer.android.com/reference/kotlin/android/service/media/MediaBrowserService.BrowserRoot#EXTRA_RECENT:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/service/media/MediaBrowserService.BrowserRoot#EXTRA_OFFLINE:kotlin.String`

## Public constructors

### BrowserRoot

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

```
BrowserRoot(
    rootId: String, 
    extras: Bundle?)
```

Constructs a browser root.

| Parameters ||
|---|---|
| `rootId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The root id for browsing. This value cannot be `null`. |
| `extras` | [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)?: Any extras about the browser service. This value may be `null`. |

## Public methods

### getExtras

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

```
fun getExtras(): Bundle!
```

Gets any extras about the browser service.

### getRootId

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

```
fun getRootId(): String!
```

Gets the root id for browsing.