1page.title=Android 2.3.4 APIs
2excludeFromSuggestions=true
3sdk.platform.version=2.3.4
4sdk.platform.apiLevel=10
5
6
7@jd:body
8
9<div id="qv-wrapper">
10<div id="qv">
11
12<h2>In this document</h2>
13<ol>
14  <li><a href="#api">API Overview</a></li>
15  <li><a href="#openaccessory">Open Accessory Library</a></li>
16  <li><a href="#api-level">API Level</a></li>
17</ol>
18
19<h2>Reference</h2>
20<ol>
21<li><a
22href="{@docRoot}sdk/api_diff/{@sdkPlatformApiLevel}/changes.html">API
23Differences Report &raquo;</a> </li>
24</ol>
25
26</div>
27</div>
28
29<p>
30<em>API Level:</em>&nbsp;<strong>{@sdkPlatformApiLevel}</strong></p>
31
32<p>Android 2.3.4 ({@link android.os.Build.VERSION_CODES#GINGERBREAD_MR1})
33is a maintenance release that adds several bug fixes and patches
34to the Android 2.3 platform, without any API changes from Android 2.3.3. Additionally,
35Android 2.3.4 brings support for the Open Accessory API to mobile devices,
36through the optional <a href="#usb">Open Accessory Library</a>. </p>
37
38<p>For developers, the Android {@sdkPlatformVersion} platform is available as a
39downloadable component for the Android SDK. The downloadable platform includes
40an Android library and system image, as well as a set of emulator skins and
41more. To get started developing or testing against Android {@sdkPlatformVersion},
42use the Android SDK Manager to download the platform into your SDK.</p>
43
44
45
46<h2 id="api">API Overview</h2>
47
48<p>Android 2.3.4 provides the same framework API to applications as Android 2.3.3
49(API level 10). For a summary of the API, see the
50<a href="{@docRoot}about/versions/android-2.3.3.html">Android 2.3.3 version notes</a>.</p>
51
52
53<h2 id="openaccessory">Open Accessory Library</h2>
54
55<p><em>Open Accessory</em> is a new capability for integrating
56connected peripherals with applications running on the platform. The capability
57is based on a USB (Universal Serial Bus) stack built into the platform and an
58API exposed to applications. Peripherals that attach to Android-powered devices
59as accessories connect as USB hosts. </p>
60
61<p>Open Accessory is introduced in <a
62href="{@docRoot}about/versions/android-3.1.html#usb">Android 3.1</a> (API level 12), but is
63made available to devices running Android 2.3.4 by means of an optional external
64library, the Open Accessory Library. The library exposes a framework API that
65lets applications discover, communicate with, and manage a variety of device
66types connected over USB. It also provides the implementation of the API against
67parts of the Android platform that are not directly exposed to applications in
68Android 2.3.4.</p>
69
70<p>The Open Accessory Library is optional on any given device. Device
71manufacturers may choose whether to include the Open Accessory Library in their
72products or exclude it. The library is forward-compatible with Android 3.1, so
73applications developed against Android 2.3.4 will run properly on devices
74running Android 3.1, if those devices support USB accessories. </p>
75
76<p>The API provided by the Open Accessory Library is based on the Open Accessory
77API provided in Android 3.1. In most areas, you can use the same techniques and
78APIs. However, developing for the Open Accessory Library on Android 2.3.4 differs
79from the standard USB API in these ways:
80
81<ul>
82<li>Obtaining a {@link android.hardware.usb.UsbManager} object &mdash; To obtain
83a {@link android.hardware.usb.UsbManager} object when using the add-on library,
84use the helper method <code>getInstance()</code> rather than {@link
85android.content.Context#getSystemService(java.lang.String) getSystemService()}
86For example:
87
88<pre>UsbManager manager = UsbManager.getInstance(this);</pre></li>
89
90<li>Obtaining a {@link android.hardware.usb.UsbAccessory} from a filtered intent
91&mdash; When you filter for a connected device or accessory with an intent
92filter, the {@link android.hardware.usb.UsbAccessory} object is contained
93inside the intent that is passed to your application. If you are using the
94add-on library, you can get the {@link android.hardware.usb.UsbAccessory} object
95in the following manner:
96
97<pre>UsbAccessory accessory = UsbManager.getAccessory(intent)</pre></li>
98
99<li>No USB host support &mdash; Android 2.3.4 and the Open Accessory Library do
100not support USB host mode (for example, through {@link
101android.hardware.usb.UsbDevice}), although USB host mode is supported in Android
1023.1. An Android-powered device running Android 2.3.4 can not function as a USB
103host. The library enables the Android-powered device to function as
104a peripheral only, with the connected accessory functioning as USB host
105(through {@link android.hardware.usb.UsbAccessory}).</li>
106</ul>
107
108<p>To develop apps using the Open Accessory Library, you need:</p>
109
110<ul>
111<li>The latest version of the Android SDK tools</li>
112<li>The latest version of the Google APIs add-on, which includes the library
113itself (for linking)</li>
114<li>An actual hardware device running Android 2.3.4 (or Android 3.1) with USB
115accessories support, for runtime testing against connected devices</li>
116</ul>
117
118<p>For a full discussion of how to develop applications that interact with USB
119accessories, please see the related <a
120href="{@docRoot}guide/topics/connectivity/usb/index.html">developer documentation</a>.</p>
121
122<p>Additionally, developers can request filtering on Google Play, such that
123their applications are not available to users whose devices do not provide the
124appropriate accessory support. To request filtering, add the element below
125to the application manifest:</p>
126
127<pre>&lt;uses-feature
128  android:name="android.hardware.usb.accessory"
129  android:required="true"&gt;</pre>
130
131
132<h2 id="api-level">API Level</h2>
133
134<p>The Android 2.3.4 platform does <em>not</em> increment the API level &mdash;
135it uses the same API level as Android 2.3.3, API level 10.
136
137<p>To use APIs introduced in API level 10 in your application,
138you need compile the application against the Android library that is provided in
139the latest version of the Google APIs Add-On, which also includes the Open
140Accessory Library.</p>
141
142<p>Depending on your needs, you might
143also need to add an <code>android:minSdkVersion="{@sdkPlatformApiLevel}"</code>
144attribute to the <code>&lt;uses-sdk&gt;</code> element in the application's
145manifest. If your application is designed to run only on Android 2.3.3 and higher,
146declaring the attribute prevents the application from being installed on earlier
147versions of the platform.</p>
148
149<p>For more information, read <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#ApiLevels">What is API
150Level?</a></p>
151