API Level: 10
Android 2.3.4 (
GINGERBREAD_MR1
)
is a maintenance release that adds several bug fixes and patches
to the Android 2.3 platform, without any API changes from Android 2.3.3. Additionally,
Android 2.3.4 brings support for the Open Accessory API to mobile devices,
through the optional
Open Accessory Library
.
For developers, the Android 2.3.4 platform is available as a downloadable component for the Android SDK. The downloadable platform includes an Android library and system image, as well as a set of emulator skins and more. To get started developing or testing against Android 2.3.4, use the Android SDK Manager to download the platform into your SDK.
API Overview
Android 2.3.4 provides the same framework API to applications as Android 2.3.3 (API level 10). For a summary of the API, see the Android 2.3.3 version notes .
Open Accessory Library
Open Accessory is a new capability for integrating connected peripherals with applications running on the platform. The capability is based on a USB (Universal Serial Bus) stack built into the platform and an API exposed to applications. Peripherals that attach to Android-powered devices as accessories connect as USB hosts.
Open Accessory is introduced in Android 3.1 (API level 12), but is made available to devices running Android 2.3.4 by means of an optional external library, the Open Accessory Library. The library exposes a framework API that lets applications discover, communicate with, and manage a variety of device types connected over USB. It also provides the implementation of the API against parts of the Android platform that are not directly exposed to applications in Android 2.3.4.
The Open Accessory Library is optional on any given device. Device manufacturers may choose whether to include the Open Accessory Library in their products or exclude it. The library is forward-compatible with Android 3.1, so applications developed against Android 2.3.4 will run properly on devices running Android 3.1, if those devices support USB accessories.
The API provided by the Open Accessory Library is based on the Open Accessory API provided in Android 3.1. In most areas, you can use the same techniques and APIs. However, developing for the Open Accessory Library on Android 2.3.4 differs from the standard USB API in these ways:
-
Obtaining a
UsbManager
object — To obtain aUsbManager
object when using the add-on library, use the helper methodgetInstance()
rather thangetSystemService()
For example:UsbManager manager = UsbManager.getInstance(this);
-
Obtaining a
UsbAccessory
from a filtered intent — When you filter for a connected device or accessory with an intent filter, theUsbAccessory
object is contained inside the intent that is passed to your application. If you are using the add-on library, you can get theUsbAccessory
object in the following manner:UsbAccessory accessory = UsbManager.getAccessory(intent)
-
No USB host support — Android 2.3.4 and the Open Accessory Library do
not support USB host mode (for example, through
UsbDevice
), although USB host mode is supported in Android 3.1. An Android-powered device running Android 2.3.4 can not function as a USB host. The library enables the Android-powered device to function as a peripheral only, with the connected accessory functioning as USB host (throughUsbAccessory
).
To develop apps using the Open Accessory Library, you need:
- The latest version of the Android SDK tools
- The latest version of the Google APIs add-on, which includes the library itself (for linking)
- An actual hardware device running Android 2.3.4 (or Android 3.1) with USB accessories support, for runtime testing against connected devices
For a full discussion of how to develop applications that interact with USB accessories, please see the related developer documentation .
Additionally, developers can request filtering on Google Play, such that their applications are not available to users whose devices do not provide the appropriate accessory support. To request filtering, add the element below to the application manifest:
<uses-feature android:name="android.hardware.usb.accessory" android:required="true">
API Level
The Android 2.3.4 platform does not increment the API level — it uses the same API level as Android 2.3.3, API level 10.
To use APIs introduced in API level 10 in your application, you need compile the application against the Android library that is provided in the latest version of the Google APIs Add-On, which also includes the Open Accessory Library.
Depending on your needs, you might
also need to add an
android:minSdkVersion="10"
attribute to the
<uses-sdk>
element in the application's
manifest. If your application is designed to run only on Android 2.3.3 and higher,
declaring the attribute prevents the application from being installed on earlier
versions of the platform.
For more information, read What is API Level?