1 page.title=Android 2.0, Release 1 2 excludeFromSuggestions=true 3 sdk.platform.version=2.0 4 sdk.platform.apiLevel=5 5 sdk.platform.majorMinor=major 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="#features">Platform Highlights</a></li> 15 <li><a href="#relnotes">Revisions</a></li> 16 <li><a href="#apps">Built-in Applications</a></li> 17 <li><a href="#locs">Locales</a></li> 18 <li><a href="#skins">Emulator Skins</a></li> 19 <li><a href="#dev-features">Developer Features</a></li> 20 <li><a href="#api">Framework API</a> 21 <ol> 22 <li><a href="#api-level">API level</a></li> 23 <li><a href="#api-changes">API changes summary</a></li> 24 <li><a href="{@docRoot}sdk/api_diff/{@sdkPlatformApiLevel}/changes.html">API differences report »</a> </li> 25 </ol></li> 26 </ol> 27 28 <h2>See Also</h2> 29 <ol> 30 <li><a href="{@docRoot}sdk/exploring.html">Exploring the SDK</a></li> 31 </ol> 32 33 </div> 34 </div> 35 36 <p> 37 <em>API Level:</em> <strong>{@sdkPlatformApiLevel}</strong></p> 38 39 <p>Android {@sdkPlatformVersion} is a {@sdkPlatformMajorMinor} platform release 40 deployable to Android-powered handsets starting in November 2009. 41 The release includes new features for users and developers, as well as changes 42 in the Android framework API. </p> 43 44 <p>For developers, the Android {@sdkPlatformVersion} platform is available as a 45 downloadable component for the Android SDK. The downloadable platform includes a 46 fully compliant Android library and system image, as well as a set of emulator 47 skins, sample applications, and more. The downloadable platform is fully 48 compliant and includes no external libraries. </p> 49 50 <p>To get started developing or testing against the Android 51 {@sdkPlatformVersion} platform, use the Android SDK and AVD Manager tool to 52 download the platform into your SDK. For more information, 53 see <a href="{@docRoot}sdk/exploring.html">Exploring the 54 SDK</a>.</p> 55 56 57 <h2 id="features">Platform Highlights</h2> 58 59 <p>For a list of new user features and platform highlights, see the <a 60 href="http://developer.android.com/about/versions/android-{@sdkPlatformVersion}-highlights.html">Android 61 {@sdkPlatformVersion} Platform Highlights</a> document.</p> 62 63 <h2 id="relnotes">Revisions</h2> 64 65 <p>The sections below provide notes about successive releases of 66 the Android {@sdkPlatformVersion} platform component for the Android SDK, as denoted by 67 revision number. To determine what revision(s) of the Android 68 {@sdkPlatformVersion} platforms are installed in your SDK environment, refer to 69 the "Installed Packages" listing in the Android SDK and AVD Manager.</p> 70 71 <script type="text/javascript"> 72 function toggleDiv(link) { 73 var toggleable = $(link).parent(); 74 if (toggleable.hasClass("closed")) { 75 //$(".toggleme", toggleable).slideDown("fast"); 76 toggleable.removeClass("closed"); 77 toggleable.addClass("open"); 78 $(".toggle-img", toggleable).attr("title", "hide").attr("src", (toRoot + "assets/images/triangle-opened.png")); 79 } else { 80 //$(".toggleme", toggleable).slideUp("fast"); 81 toggleable.removeClass("open"); 82 toggleable.addClass("closed"); 83 $(".toggle-img", toggleable).attr("title", "show").attr("src", (toRoot + "assets/images/triangle-closed.png")); 84 } 85 return false; 86 } 87 </script> 88 <style> 89 .toggleable { 90 padding: .25em 1em; 91 } 92 .toggleme { 93 padding: 1em 1em 0 2em; 94 line-height:1em; 95 } 96 .toggleable a { 97 text-decoration:none; 98 } 99 .toggleable.closed .toggleme { 100 display:none; 101 } 102 #jd-content .toggle-img { 103 margin:0; 104 } 105 </style> 106 107 <div class="toggleable opened"> 108 <a href="#" onclick="return toggleDiv(this)"> 109 <img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-img" height="9px" width="9px" /> 110 Android 2.0, Revision 1</a> <em>(October 2009)</em></a> 111 <div class="toggleme"> 112 <dl> 113 <dt>Dependencies:</dt> 114 <dd> 115 <p>Requires SDK Tools r3 or higher.</p> 116 </dd> 117 </dl> 118 </div> 119 </div> 120 121 <h2 id="apps">Built-in Applications</h2> 122 123 <p>The system image included in the downloadable platform provides these 124 built-in applications:</p> 125 126 <table style="border:0;padding-bottom:0;margin-bottom:0;"> 127 <tr> 128 <td style="border:0;padding-bottom:0;margin-bottom:0;"> 129 <ul> 130 <li>Alarm Clock</li> 131 <li>Browser</li> 132 <li>Calculator</li> 133 <li>Camcorder</li> 134 <li>Camera</li> 135 <li>Contacts</li> 136 <li>Custom Locale (developer app)</li> 137 <li>Dev Tools (developer app)</li> 138 <li>Dialer</li> 139 </ul> 140 </td> 141 <td style="border:0;padding-bottom:0;margin-bottom:0;padding-left:5em;"> 142 <ul> 143 <li>Email</li> 144 <li>Gallery</li> 145 <li>Gestures Builder</li> 146 <li>IME for Japanese text input</li> 147 <li>Messaging</li> 148 <li>Music</li> 149 <li>Settings</li> 150 <li>Spare Parts (developer app)</li> 151 </ul> 152 </td> 153 </tr> 154 </table> 155 156 <h2 id="locs" style="margin-top:.75em;">Locales</h2> 157 158 <p>The system image included in the downloadable platform provides a variety of 159 built-in locales. In some cases, region-specific strings are available for the 160 locales. In other cases, a default version of the language is used. The 161 languages that are available in the Android {@sdkPlatformVersion} system 162 image are listed below (with <em>language</em>_<em>country/region</em> locale 163 descriptor).</p> 164 165 <table style="border:0;padding-bottom:0;margin-bottom:0;"> 166 <tr> 167 <td style="border:0;padding-bottom:0;margin-bottom:0;"> 168 <ul> 169 <li>Chinese, PRC (zh_CN)</li> 170 <li>Chinese, Taiwan (zh_TW)</li> 171 <li>Czech (cs_CZ)</li> 172 <li>Dutch, Netherlands (nl_NL)</li> 173 <li>Dutch, Belgium (nl_BE)</li> 174 <li>English, US (en_US)</li> 175 <li>English, Britain (en_GB)</li> 176 <li>English, Canada (en_CA)</li> 177 <li>English, Australia (en_AU)</li> 178 <li>English, New Zealand (en_NZ)</li> 179 <li>English, Singapore(en_SG)</li> 180 <li>French, France (fr_FR)</li> 181 <li>French, Belgium (fr_BE)</li> 182 </ul> 183 </td> 184 <td style="border:0;padding-bottom:0;margin-bottom:0;padding-left:5em;"> 185 <li>French, Canada (fr_CA)</li> 186 <li>French, Switzerland (fr_CH)</li> 187 <li>German, Germany (de_DE)</li> 188 <li>German, Austria (de_AT)</li> 189 <li>German, Switzerland (de_CH)</li> 190 <li>German, Liechtenstein (de_LI)</li> 191 <li>Italian, Italy (it_IT)</li> 192 <li>Italian, Switzerland (it_CH)</li> 193 <li>Japanese (ja_JP)</li> 194 <li>Korean (ko_KR)</li> 195 <li>Polish (pl_PL)</li> 196 <li>Russian (ru_RU)</li> 197 <li>Spanish (es_ES)</li> 198 </td> 199 </tr> 200 </table> 201 202 <p>Localized UI strings match the locales that are accessible 203 through Settings.</p> 204 205 <h2 id="skins">Emulator Skins</h2> 206 207 <p>The downloadable platform includes a set of emulator skins that you can use for modeling your application in different screen sizes and resolutions. The emulator skins are: </p> 208 209 <ul> 210 <li> 211 QVGA (240x320, low density, small screen) 212 </li> 213 <li> 214 WQVGA (240x400, low density, normal screen) 215 </li> 216 <li> 217 FWQVGA (240x432, low density, normal screen) 218 </li> 219 <li> 220 HVGA (320x480, medium density, normal screen) 221 </li> 222 <li> 223 WVGA800 (480x800, high density, normal screen) 224 </li> 225 <li> 226 WVGA854 (480x854 high density, normal screen) 227 </li> 228 </ul> 229 230 <p>For more information about how to develop an application that displays and functions properly on all Android-powered devices, see <a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a>.</p> 231 232 <h2 id="dev-features">Developer Features</h2> 233 234 <p>The sections below provide information about new developer features offered by the downloadable Android 2.0 platform component.</p> 235 236 <h3 id="ant">Ant Support</h3> 237 238 <ul> 239 <li>Debug- and release-mode application signing. Release-mode signing includes integrated support for <code>zipalign</code> optimization. For more information, see <a href="{@docRoot}tools/publishing/app-signing.html#releasecompile">Signing Your Applications</a>.</li> 240 241 <li>Adds new Ant build system with support for Emma instrumentation projects (code coverage).</li> 242 </ul> 243 244 <h2 id="api">Framework API</h2> 245 246 <p>The sections below provide information about the application framework API provided by the Android {@sdkPlatformVersion} platform. </p> 247 248 249 <h3 id="api-level">API level</h3> 250 251 <p>The Android {@sdkPlatformVersion} platform delivers an updated version of the framework 252 API. As with previous versions, the Android {@sdkPlatformVersion} API 253 is assigned an integer identifier — <strong>{@sdkPlatformApiLevel}</strong> — that is 254 stored in the system itself. This identifier, called the "API Level", allows the 255 system to correctly determine whether an application is compatible with 256 the system, prior to installing the application. </p> 257 258 <p>To use APIs introduced in Android {@sdkPlatformVersion} in your application, you need to 259 set the proper value, "{@sdkPlatformApiLevel}", in the attributes of the <code><uses-sdk></code> 260 element in your application's manifest. </p> 261 262 <p>For more information about how to use API Level, see the <a 263 href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#ApiLevels">API Levels</a> document. </p> 264 265 266 <h3 id="api-changes">API changes summary</h3> 267 268 <h4>Bluetooth</h4> 269 <ul> 270 <li>Turn on/off Bluetooth</li> 271 <li>Device and service discovery</li> 272 <li>Connect to a remote device using RFCOMM and send/receive data</li> 273 <li>Advertise RFCOMM services and listen for incoming RFCOMM connection</li> 274 </ul> 275 276 <h4>Sync adapters </h4> 277 <ul> 278 <li>New APIs for sync adapters to connect to any backend</li> 279 </ul> 280 281 <h4>Account Manager</h4> 282 <ul> 283 <li>Centralized account manager API to securely store and access auth tokens/passwords </li> 284 </ul> 285 286 <h4>Contacts</h4> 287 <ul> 288 <li>New contacts APIs that allow for data from multiple accounts</li> 289 <li>New Quick Contact framework APIs enable developers to create contact badges in their app. Clicking on the badge opens a window with a list of ways to contact the person with one click.</li> 290 </ul> 291 292 <h4>WebView</h4> 293 <ul> 294 <li>Deprecated classes: UrlInterceptHandler, Plugin, PluginData, PluginList, UrlInterceptRegistry.</li> 295 </ul> 296 297 <h4>Camera</h4> 298 <ul> 299 <li>New parameters for color effect, scene mode, flash mode, focus mode, white balance, rotation, and other settings.</li> 300 <li>New ZoomCallback interface to perform actions when the zoom level has changed.</li> 301 </ul> 302 303 <h4>Media</h4> 304 <ul> 305 <li>MediaScanner now generates thumbnails for all images when they are inserted into MediaStore.</li> 306 <li>New Thumbnail API for retrieving image and video thumbnails on demand.</li> 307 </ul> 308 309 <h4>Other Framework</h4> 310 <ul> 311 <li>New system themes in android.R.style to easily display activities on top of the current system wallpaper or keep the previous activity visible in the background. </li> 312 <li>New WallpaperManager API replaces and extends the wallpaper APIs that were previously in Context, to allow applications to request and set the system wallpaper.</li> 313 <li>New Service APIs to help applications correctly handle Service life-cycle, in particular low memory situations where a Service may be killed while it is running. 314 <ul> 315 <li>Service.setForeground() has been deprecated and now effectively performs no operation. This is replaced with a new API, startForeground(), that helps (and requires) associating an ongoing notification with the foreground state.</li> 316 </ul> 317 </li> 318 <li>MotionEvent can now report simultaneous-touch information for devices that support it. Up to three pointers can be tracked simultaneously. </li> 319 <li>KeyEvent has new key dispatching APIs, to help implement action-on-up and long press behavior, as well a new mechanism to cancel key presses (for virtual keys).</li> 320 <li>WindowManager.LayoutParams has new constants that allow a window to wake up the screen when it is displayed and show the window even if the screen is locked. This allows applications to more cleanly implement things like alarm clocks that should wake the device.</li> 321 <li>New Intent APIs that broadcast the docking state of the device and allow applications to launch special activities when the device is placed in a desktop or car dock.</li> 322 </ul> 323 324 <h4>Key events executed on key-up</h4> 325 326 <p>Android 2.0 is designed to run on devices that use virtual keys for HOME, 327 MENU, BACK, and SEARCH, rather than physical keys. To support the best user 328 experience on those devices, the Android platform now executes these buttons at 329 key-up, for a key-down/key-up pair, rather than key-down. This helps prevent 330 accidental button events and lets the user press the button area and then drag 331 out of it without generating an event. </p> 332 333 <p>This change in behavior should only affect your application if it is 334 intercepting button events and taking an action on key-down, rather than on 335 key-up. Especially if your application is intercepting the BACK key, you should 336 make sure that your application is handling the key events properly. </p> 337 338 <p>In general, intercepting the BACK key in an application is not recommended, 339 however, if your application is doing so and it invokes some action on 340 key-down, rather than key-up, you should modify your code. </p> 341 342 <p>If your application will use APIs introduced in Android 2.0 (API Level 5), 343 you can take advantage of new APIs for managing key-event pairs:</p> 344 345 <ul> 346 <li>If you are intercepting the BACK key in an activity or dialog, just 347 implement the new {@link android.app.Activity#onBackPressed()} method. </li> 348 <li>If you are intercepting the BACK key in a view, you should track the key 349 event on key-down (through the new {@link android.view.KeyEvent#startTracking} 350 method), then invoke the action at key up. Here's a pattern you can use:</li> 351 352 <pre> public boolean onKeyDown(int keyCode, KeyEvent event) { 353 if (keyCode == KeyEvent.KEYCODE_BACK 354 && event.getRepeatCount() == 0) { 355 event.startTracking(); 356 return true; 357 } 358 return super.onKeyDown(keyCode, event); 359 } 360 361 public boolean onKeyUp(int keyCode, KeyEvent event) { 362 if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking() 363 && !event.isCanceled()) { 364 // *** DO ACTION HERE *** 365 return true; 366 } 367 return super.onKeyUp(keyCode, event); 368 }</pre> 369 370 </ul> 371 372 <p>If you want to update a legacy application so that its handling of the BACK 373 key works properly for both Android 2.0 and older platform versions, you 374 can use an approach similar to that shown above. Your code can catch the 375 target button event on key-down, set a flag to track the key event, and 376 then also catch the event on key-up, executing the desired action if the tracking 377 flag is set. You'll also want to watch for focus changes and clear the tracking 378 flag when gaining/losing focus.</p> 379 380 <h3 id="api-diff">API differences report</h3> 381 382 <p>For a detailed view of API changes in Android {@sdkPlatformVersion} (API Level {@sdkPlatformApiLevel}), as compared to 383 the previous version, see the <a 384 href="{@docRoot}sdk/api_diff/{@sdkPlatformApiLevel}/changes.html">API Differences Report</a>.</p> 385 386