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