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