# MediaLibraryService.LibraryParams

Artifact: [androidx.media3:media3-session](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/session/MediaLibraryService.java+class:androidx.media3.session.MediaLibraryService.LibraryParams)

*** ** * ** ***


```
public final class MediaLibraryService.LibraryParams
```

<br />

*** ** * ** ***

Parameters for the interaction between `https://developer.android.com/reference/androidx/media3/session/MediaBrowser` and `https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.MediaLibrarySession`.

When a `https://developer.android.com/reference/androidx/media3/session/MediaBrowser` specifies the parameters, the `https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.MediaLibrarySession` is recommended to provide a result matching the parameters, but it's not an error if `https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.MediaLibrarySession` can't fulfil the request.

Multiple parameters can be combined together, for example to request `https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.LibraryParams#isSuggested()` items that are also `https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.LibraryParams#isOffline()`.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.LibraryParams.Builder` A builder for `https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.LibraryParams`. |

| ### Public fields |
|---|---|
| `final https://developer.android.com/reference/android/os/Bundle.html` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.LibraryParams#extras()` An extra `https://developer.android.com/reference/android/os/Bundle.html` for the private contract between `https://developer.android.com/reference/androidx/media3/session/MediaBrowser` and `https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.MediaLibrarySession`. |
| `final boolean` | `https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.LibraryParams#isOffline()` Whether the media items can be played without an internet connection. |
| `final boolean` | `https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.LibraryParams#isRecent()` Whether the media items are recently played. |
| `final boolean` | `https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.LibraryParams#isSuggested()` Whether the media items are suggested. |

| ### Public methods |
|---|---|
| `static https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.LibraryParams` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.LibraryParams#fromBundle(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle.html bundle)` Restores a `LibraryParams` from a `https://developer.android.com/reference/android/os/Bundle.html`. |
| `https://developer.android.com/reference/android/os/Bundle.html` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.LibraryParams#toBundle()()` |

## Public fields

### extras

```
@UnstableApi
public final Bundle extras
```

An extra `https://developer.android.com/reference/android/os/Bundle.html` for the private contract between `https://developer.android.com/reference/androidx/media3/session/MediaBrowser` and `https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.MediaLibrarySession`.

### isOffline

```
public final boolean isOffline
```

Whether the media items can be played without an internet connection.

When a `https://developer.android.com/reference/androidx/media3/session/MediaBrowser` specifies it as `true`, the `https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.MediaLibrarySession` is recommended to provide offline media items. If so, the implementation must return the parameter with `true` as well.

When a `https://developer.android.com/reference/androidx/media3/session/MediaBrowser` specifies it as `false`, the `https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.MediaLibrarySession` doesn't have to care about the offline playability of media items.

### isRecent

```
public final boolean isRecent
```

Whether the media items are recently played.

When a `https://developer.android.com/reference/androidx/media3/session/MediaBrowser` specifies it as `true`, the `https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.MediaLibrarySession` is recommended to provide the recently played media items. If so, the implementation must return the parameter with `true` as well. The list of media items is sorted by relevance, the first being the most recent.

When a `https://developer.android.com/reference/androidx/media3/session/MediaBrowser` specifies it as `false`, the `https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.MediaLibrarySession` doesn't have to care about the recentness of media items.

### isSuggested

```
public final boolean isSuggested
```

Whether the media items are suggested.

When a `https://developer.android.com/reference/androidx/media3/session/MediaBrowser` specifies it as `true`, the `https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.MediaLibrarySession` is recommended to provide suggested media items. If so, the implementation must return the parameter with `true` as well. The list of media items is sorted by relevance, the first being the top suggestion.

When a `https://developer.android.com/reference/androidx/media3/session/MediaBrowser` specifies it as `false`, the `https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.MediaLibrarySession` doesn't have to care about the suggestion for media items.

## Public methods

### fromBundle

```
@UnstableApi
public static MediaLibraryService.LibraryParams fromBundle(Bundle bundle)
```

Restores a `LibraryParams` from a `https://developer.android.com/reference/android/os/Bundle.html`.

### toBundle

```
@UnstableApi
public Bundle toBundle()
```