java.lang.Object | |
↳ | android.media.browse.MediaBrowser |
Browses media content offered by a link MediaBrowserService.
This object is not thread-safe. All calls should happen on the thread on which the browser was constructed.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
MediaBrowser.ConnectionCallback | Callbacks for connection related events. | ||||||||||
MediaBrowser.MediaItem | |||||||||||
MediaBrowser.SubscriptionCallback | Callbacks for subscription related events. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a media browser for the specified media browse service.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Connects to the media browse service.
| |||||||||||
Disconnects from the media browse service.
| |||||||||||
Gets any extras for the media service.
| |||||||||||
Gets the root id.
| |||||||||||
Gets the service component that the media browser is connected to.
| |||||||||||
Gets the media session token associated with the media browser.
| |||||||||||
Returns whether the browser is connected to the service.
| |||||||||||
Queries for information about the media items that are contained within
the specified id and subscribes to receive updates when they change.
| |||||||||||
Unsubscribes for changes to the children of the specified media id.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Creates a media browser for the specified media browse service.
context | The context. |
---|---|
serviceComponent | The component name of the media browse service. |
callback | The connection callback. |
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. |
Connects to the media browse service.
The connection callback specified in the constructor will be invoked when the connection completes or fails.
Disconnects from the media browse service. After this, no more callbacks will be received.
Gets any extras for the media service.
IllegalStateException | if not connected. |
---|
Gets the root id.
Note that the root id may become invalid or change when when the browser is disconnected.
IllegalStateException | if not connected. |
---|
Gets the service component that the media browser is connected to.
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.
IllegalStateException | if not connected. |
---|
Returns whether the browser is connected to the service.
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 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.
parentId | The id of the parent media item whose list of children will be subscribed. |
---|---|
callback | The callback to receive the list of children. |
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.
parentId | The id of the parent media item whose list of children will be unsubscribed. |
---|