page.title=Custom Accessories @jd:body
An accessory for Android can be anything: keyboard, thermometer, robot, lighting control or anything else you can imagine. Accessories for Android all have one thing in common; they all connect to an Android device in some way. When starting out to build an accessory, you should decide how your accessory will connect to Android devices. This page gives you quick overview of your options for connecting your Android accessory and resources to help you get started.
An accessory that connects to an Android device through a USB cable must support the Android Open Accessory (AOA) protocol, which specifies how an accessory can establish communication with an Android device over a USB cable. Due to the low power output of Android devices, the AOA protocol requires the accessory act as a USB host, which means that the connecting accessory must power the bus.
The AOA protocol has two versions which support different types of communication. Version 1.0 supports a generic accessory communication and adb debugging. This version of the protocol is supported by the platform in Android 3.1 (API Level 12) and higher, and supported through an Add-On Library in Android 2.3.4 (API Level 10) and higher. Version 2.0 of the protocol is available in Android 4.1 (API Level 16) and adds audio streaming and human interface device (HID) capabilities.
If you use the general accessory protocol to communicate with your accessory (rather than the adb or audio protocol), you must provide an Android application that can detect the connection of your USB accessory and establish communication.
To get started on building an Android accessory that uses a USB connection:
<adk-src>/adk2012/board/library/ADK2/
), which demonstrates an implementation of an accessory
using a USB connection for general data communications and audio streaming.<adk-src>/adk2012/app/
).An accessory that connects with Android devices over a Bluetooth connection can use the various connection profiles supported by Android, including the Simple Serial Protocol (SSP) and Advanced Audio Distribution Profile (A2DP) profile. An accessory that uses Bluetooth to connect to Android devices must support Bluetooth communications and at least one of the supported connection profiles.
Users must enable Bluetooth on their Android device and pair with your accessory in order to use it. You can also provide a secondary Android application that handles any specialized communication, such as data input or control outputs, to interface with your accessory.
To get started on building an Android accessory that uses a Bluetooth connection:
<adk-src>/adk2012/board/library/ADK2/
), which includes an example implementation
of general data communications and audio streaming using a Bluetooth connection.<adk-src>/adk2012/app/
).Note: The ADK 2012 source code includes an open source Bluetooth stack which is built for the Texas Instruments CC2564 chip, but can work with any Bluetooth chip that supports a standard Host/Controller Interface (HCI).
An accessory that connects with Android over USB connection may use the Android Open Accessory (AOA) protocol version 2.0. This version of the AOA protocol is supported on Android 4.1 (API Level 16) and higher. Once an Android device connects to an accessory that supports this protocol, the Android system treats it as a standard audio output device and routes all audio to that accessory. No secondary software application is required on the Android device.
Note: Due to the low power output of Android devices, the Android Open Accessory Protocol requires that accessories act as a USB host, which means that the connecting accessory must power the bus.
To get started on building an audio accessory that uses a USB connection:
<adk-src>/adk2012/board/library/ADK2/
), which includes an example implementation
of an audio playback accessory using a USB connection.Note: The AOA 2.0 protocol also supports the human interface device (HID) protocol through a USB connection, enabling accessories such as audio docks to provide hardware play back controls such as pause, fast-forward or volume buttons.