1 page.title=Building Audio Accessories 2 @jd:body 3 4 <!-- 5 Copyright 2010 The Android Open Source Project 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 --> 19 <p>In building an audio accessory, such as an audio dock or other playback device, you should 20 consider how your accessory will connect with Android devices. In particular, you should decide 21 if your accessory will use Universal Serial Bus (USB) or a Bluetooth connection to stream music or 22 other audio content.</p> 23 <h2 id="audio-over-usb">Audio over USB</h2> 24 <p>An accessory that connects with Android over USB connection must use the Android Open 25 Accessory (AOA) protocol version 2.0. This version of the AOA protocol is supported on Android 4.1 26 (API Level 16) and higher. Once an Android device connects to an accessory that supports this 27 protocol, the Android system treats it as a standard audio output device and routes all audio to 28 that accessory. No secondary software application is required on the Android device.</p> 29 <p><strong>Note:</strong> Due to the low power output of Android devices, the Android Open Accessory 30 Protocol requires that accessories act as a USB host, which means that the connecting accessory 31 must power the bus.</p> 32 <h3 id="next-steps">Next steps</h3> 33 <p>To get started on building an audio accessory that uses a USB connection:</p> 34 <ul> 35 <li>Select a hardware platform or build a hardware device that can support USB host mode.</li> 36 <li>Review the <a href="{@docRoot}accessories/aoa2.html">AOA 2.0 protocol</a> specification to understand 37 how to implement this protocol on your accessory hardware.</li> 38 <li>Review the ADK 2012 <a href="http://developer.android.com/tools/adk/adk2.html#src-download">firmware source code</a> 39 (<code><adk-src>/adk2012/board/library/ADK2/</code>), which includes an example implementation 40 of an audio playback accessory using a USB connection.</li> 41 </ul> 42 <p><strong>Note:</strong> The AOA 2.0 protocol also supports the 43 <a href="{@docRoot}accessories/aoa2.html#hid-support">human interface device</a> (HID) protocol through a USB 44 connection, enabling accessories such as audio docks to provide hardware play back controls such 45 as pause, fast-forward or volume buttons.</p> 46 <h2 id="audio-over-bluetooth">Audio over Bluetooth</h2> 47 <p>An accessory that connects with Android over Bluetooth can use an Advanced Audio Distribution 48 Profile (A2DP) connection stream music for playback. Playing audio over a Bluetooth with A2DP is 49 supported on Android 1.5 (API Level 3) and higher. An Android user can connect to an accessory 50 that supports this profile using the system Settings > Bluetooth and play music directly to the 51 accessory without the need for a secondary application.</p> 52 <p><strong>Note:</strong> If you want to provide a custom application for output to your audio 53 accessory, note that the Android 3.0 (API Level 11) allows applications to operate an A2DP 54 connection using the 55 <a href="http://developer.android.com/reference/android/bluetooth/BluetoothA2dp.html"><code>BluetoothA2dp</code></a> 56 class.</p> 57 <h3 id="next-steps_1">Next steps</h3> 58 <p>To get started on building an audio accessory that uses a Bluetooth connection:</p> 59 <ul> 60 <li>Select a hardware platform or build an hardware device that can support Bluetooth 61 communications and the A2DP connection profile.</li> 62 <li>Review the ADK 2012 63 <a href="http://developer.android.com/tools/adk/adk2.html#src-download">firmware source code</a> 64 (<code><adk-src>/adk2012/board/library/ADK2/</code>), which includes an example implementation 65 of an audio playback accessory using a Bluetooth connection.</li> 66 </ul> 67 <p><strong>Note:</strong> The ADK 2012 source code includes an open source Bluetooth stack that 68 is built for the Texas Instruments CC2564 chip, but can work with any Bluetooth chip that 69 implements a standard Host/Controller Interface (HCI).</p> 70 71