Starting March 27, 2025, we recommend using android-latest-release
instead of aosp-main
to build and contribute to AOSP. For more information, see Changes to AOSP.
Build audio accessories
Stay organized with collections
Save and categorize content based on your preferences.
When implementing an audio accessory such as a headset, headphone amplifier,
microphone, DAC/ADC, or dock, consider how the accessory connects to Android
devices. The following sections describe wired 3.5 mm headset connections,
Universal Serial Bus (USB) connections, and Bluetooth connections for streaming
music or other audio content.
Audio over 3.5 mm headset connector
Many Android devices include a 3.5 mm (“mini”) headset connector.
In addition to traditional stereo output and mono input features, the
3.5 mm headset specification
defines standard impedances and functions that enable interoperability between
a range of Android devices and headsets.
Audio over USB
Android can use USB in several modes:
- Development. Does not support audio.
- Accessory. Provided by Android Open Accessory (AOA) 2.0
and provides limited audio capability, as described in
Connecting custom audio over USB.
- Host. Enables the Android device to drive the USB bus
and operate with a wide range of USB-based peripherals, including audio
interfaces. Devices that implement host mode will be compatible with USB
headsets that follow the
USB
headset specification.
Host mode audio is described in
USB digital audio.
Audio over Bluetooth
An accessory that connects with Android over Bluetooth can use an Advanced
Audio Distribution Profile (A2DP) connection to stream music for playback. Playing
audio over Bluetooth with A2DP is supported on Android 1.5 (API Level 3) and
higher. An Android user can connect to an accessory that supports this profile
using the system Settings > Bluetooth and play music directly to the
accessory without a secondary application.
As of Android 3.0 (API Level 11), applications can operate an A2DP connection
using the
BluetoothA2dp
class. To provide a custom application for
output to an audio accessory, you must use Android 3.0 or higher.
Next steps
To get started building an audio accessory that uses a Bluetooth connection:
- Select a hardware platform or build a hardware device that can support
Bluetooth communications and the A2DP connection profile.
- Review the ADK 2012
firmware
source code (
<adk-src>/adk2012/board/library/ADK2/
),
which includes an example implementation of an audio playback accessory using
a Bluetooth connection.
Note: The ADK 2012 source code includes an open
source Bluetooth stack built for the Texas Instruments CC2564 chip, but is
designed to work with any Bluetooth chip that implements a standard
Host/Controller Interface (HCI).
MIDI over USB and Bluetooth LE
Both USB and Bluetooth Low Energy can be used as transports for the
MIDI protocol. For details, see
MIDI.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-08-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-26 UTC."],[],[],null,["# Build audio accessories\n\nWhen implementing an audio accessory such as a headset, headphone amplifier,\nmicrophone, DAC/ADC, or dock, consider how the accessory connects to Android\ndevices. The following sections describe wired 3.5 mm headset connections,\nUniversal Serial Bus (USB) connections, and Bluetooth connections for streaming\nmusic or other audio content.\n\nAudio over 3.5 mm headset connector\n-----------------------------------\n\nMany Android devices include a 3.5 mm (\"mini\") headset connector.\nIn addition to traditional stereo output and mono input features, the\n[3.5 mm headset specification](/docs/core/interaction/accessories/headset/plug-headset-spec)\ndefines standard impedances and functions that enable interoperability between\na range of Android devices and headsets.\n\nAudio over USB\n--------------\n\nAndroid can use USB in several modes:\n\n- **Development**. Does not support audio.\n- **Accessory** . Provided by Android Open Accessory (AOA) 2.0 and provides limited audio capability, as described in [Connecting custom audio over USB](/docs/core/interaction/accessories/custom#audio-over-usb).\n- **Host** . Enables the Android device to drive the USB bus and operate with a wide range of USB-based peripherals, including audio interfaces. Devices that implement host mode will be compatible with USB headsets that follow the [USB\n headset specification](/docs/core/interaction/accessories/headset/usb-headset-spec). Host mode audio is described in [USB digital audio](/docs/core/audio/usb).\n\nAudio over Bluetooth\n--------------------\n\nAn accessory that connects with Android over Bluetooth can use an Advanced\nAudio Distribution Profile (A2DP) connection to stream music for playback. Playing\naudio over Bluetooth with A2DP is supported on Android 1.5 (API Level 3) and\nhigher. An Android user can connect to an accessory that supports this profile\nusing the system Settings \\\u003e Bluetooth and play music directly to the\naccessory without a secondary application.\n\nAs of Android 3.0 (API Level 11), applications can operate an A2DP connection\nusing the\n[`BluetoothA2dp`](http://developer.android.com/reference/android/bluetooth/BluetoothA2dp.html) class. To provide a custom application for\noutput to an audio accessory, you must use Android 3.0 or higher.\n\n### Next steps\n\nTo get started building an audio accessory that uses a Bluetooth connection:\n\n- Select a hardware platform or build a hardware device that can support Bluetooth communications and the A2DP connection profile.\n- Review the ADK 2012 [firmware\n source code](http://developer.android.com/tools/adk/adk2.html#src-download) (`\u003cadk-src\u003e/adk2012/board/library/ADK2/`), which includes an example implementation of an audio playback accessory using a Bluetooth connection.\n\n**Note:** The ADK 2012 source code includes an open\nsource Bluetooth stack built for the Texas Instruments CC2564 chip, but is\ndesigned to work with any Bluetooth chip that implements a standard\nHost/Controller Interface (HCI).\n\nMIDI over USB and Bluetooth LE\n------------------------------\n\nBoth USB and Bluetooth Low Energy can be used as transports for the\n[MIDI](http://en.wikipedia.org/wiki/MIDI) protocol. For details, see\n[MIDI](/docs/core/audio/midi)."]]