Skip to content

Most visited

Recently visited


Building an Audio App

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.

Audio activity and BrowserService

A MediaBrowserService provides two main features:

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. 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.

Building a Media Browser Service
How to create a media browser service that contains a media session, manage client connections, and become a foreground service while playing audio.
Building a Media Browser Client
How to create a media browser client activity that contains a UI and media controller, and connect and communicate with a media browser service.
Media Session Callbacks
Describes how the media session callback methods manage the media session, media browser service, and other app components like notifications and broadcast receivers.
This GitHub sample shows how to implement a media app that allows background playback of audio, and provides a media library that is exposed to other apps.
This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields


Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (Dec 2017 Android Platform & Tools Survey)