Audio app overview

The preferred architecture for an audio app is a client/server design. The player and its media session are implemented inside a MediaBrowserService, and the UI and media controller live inside an Android activity along with a MediaBrowser.

A MediaBrowserService provides two main features:

When you use a MediaBrowserService, other components and applications with a MediaBrowser can discover your service, create their own media controller, connect to your media session, and control the player. This is how Wear OS and Android Auto Applications gain access to your media application.

It is also provides an optional browsing API. Applications don't have to use this feature. The browsing API lets clients query the service and build out a representation of its content hierarchy, which might represent playlists, a media library, or some other kind of collection.

Note: As is the case with media session and
media controller, the recommended implementation of media browser services and
media browsers are the classes `MediaBrowserServiceCompat` and `MediaBrowserCompat`,
which are defined in the
[media-compat support library](http://developer.android.youdaxue.com/topic/libraries/support-library/features.html#v4-media-compat).
They replace earlier versions of the
classes `MediaBrowserService` and `MediaBrowser` that were introduced in API 21. For
brevity, the terms "MediaBrowserService" and "MediaBrowser" refer to instances
of `MediaBrowserServiceCompat` and `MediaBrowserCompat` respectively.