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