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