Home | History | Annotate | Download | only in sdk
      1 page.title=Android 2.2 Platform
      2 sdk.platform.version=2.2
      3 sdk.platform.apiLevel=8
      4 sdk.platform.majorMinor=minor
      5 sdk.platform.deployableDate=May 2010
      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="#api-level">API Level</a></li>
     17   <li><a href="#api">Framework API Changes</a>
     18   <li><a href="#apps">Built-in Applications</a></li>
     19   <li><a href="#locs">Locales</a></li>
     20   <li><a href="#skins">Emulator Skins</a></li>
     21 
     22     </ol>
     23   </li>
     24 </ol>
     25 
     26 <h2>Reference</h2>
     27 <ol>
     28 <li><a
     29 href="{@docRoot}sdk/api_diff/{@sdkPlatformApiLevel}/changes.html">API
     30 Differences Report &raquo;</a> </li>
     31 </ol>
     32 
     33 <h2>See Also</h2>
     34 <ol>
     35   <li><a href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a></li>
     36 </ol>
     37 
     38 </div>
     39 </div>
     40 
     41 <p>
     42 <em>API Level:</em>&nbsp;<strong>{@sdkPlatformApiLevel}</strong></p>
     43 
     44 <p>Android {@sdkPlatformVersion} is a {@sdkPlatformMajorMinor} platform release including user
     45 features, developer features, API changes, and bug
     46 fixes. For  information on developer features and API changes, see the 
     47 <a href="#api">Framework API</a> section.</p>
     48 
     49 <p>For developers, the Android {@sdkPlatformVersion} platform is available as a
     50 downloadable component for the Android SDK. The downloadable platform includes a
     51 fully compliant Android library and system image, as well as a set of emulator
     52 skins, sample applications, and more. The downloadable platform
     53 includes no external libraries. </p>
     54 
     55 <p>To get started developing or testing against the Android
     56 {@sdkPlatformVersion} platform, use the Android SDK and AVD Manager tool to
     57 download the platform into your SDK. For more information,
     58 see <a href="{@docRoot}sdk/adding-components.html">Adding SDK
     59 Components</a>. If you are new to Android, <a
     60 href="{@docRoot}sdk/index.html">download the SDK Starter Package</a>
     61 first.</p>
     62 
     63 
     64 <h2 id="features">Platform Highlights</h2>
     65 
     66 <p>For a list of new user features and platform highlights, see the <a 
     67 href="http://developer.android.com/sdk/android-2.2-highlights.html">Android
     68 2.2 Platform Highlights</a> document.</p>
     69 
     70 <h2 id="relnotes">Revisions</h2>
     71 
     72 <p>The sections below provide notes about successive releases of
     73 the Android {@sdkPlatformVersion} platform component for the Android SDK, as denoted by
     74 revision number. To determine what revision(s) of the Android
     75 {@sdkPlatformVersion} platforms are installed in your SDK environment, refer to
     76 the "Installed Packages" listing in the Android SDK and AVD Manager.</p>
     77 
     78 <script type="text/javascript">
     79 function toggleDiv(link) {
     80   var toggleable = $(link).parent();
     81   if (toggleable.hasClass("closed")) {
     82     //$(".toggleme", toggleable).slideDown("fast");
     83     toggleable.removeClass("closed");
     84     toggleable.addClass("open");
     85     $(".toggle-img", toggleable).attr("title", "hide").attr("src", (toRoot + "assets/images/triangle-opened.png"));
     86   } else {
     87     //$(".toggleme", toggleable).slideUp("fast");
     88     toggleable.removeClass("open");
     89     toggleable.addClass("closed");
     90     $(".toggle-img", toggleable).attr("title", "show").attr("src", (toRoot + "assets/images/triangle-closed.png"));
     91   }
     92   return false;
     93 }
     94 </script>
     95 <style>
     96 .toggleable {
     97   padding: .25em 1em 0em 1em;
     98   margin-bottom: 0;
     99 }
    100 .toggleme {
    101   padding: 1em 1em 0 2em;
    102   line-height:1em;
    103 }
    104 .toggleable a {
    105   text-decoration:none;
    106 }
    107 .toggleme a {
    108   text-decoration:underline;
    109 }
    110 .toggleable.closed .toggleme {
    111   display:none;
    112 }
    113 #jd-content .toggle-img {
    114   margin:0;
    115 }
    116 </style>
    117 
    118 <div class="toggleable opened">
    119   <a href="#" onclick="return toggleDiv(this)">
    120         <img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-img" height="9px" width="9px" />
    121         Android {@sdkPlatformVersion}, Revision 1</a> <em>(May 2010)</em></a>
    122   <div class="toggleme">
    123 <dl>
    124 <dt>Dependencies:</dt>
    125 <dd>
    126 <p>Requires SDK Tools r6 or higher.</p>
    127 </dd>
    128 
    129 <dt>Tools:</dt>
    130 <dd>
    131 <p>Adds support for building with Android library projects. See <a href="tools-notes.html">SDK Tools, r6</a> for information.</p>
    132 </dd>
    133 
    134 </dl>
    135  </div>
    136 </div>
    137 
    138 
    139 <h2 id="api-level">API Level</h2>
    140 
    141 <p>The Android {@sdkPlatformVersion} platform delivers an updated version of
    142 the framework API. The Android {@sdkPlatformVersion} API
    143 is assigned an integer identifier &mdash;
    144 <strong>{@sdkPlatformApiLevel}</strong> &mdash; that is
    145 stored in the system itself. This identifier, called the "API Level", allows the
    146 system to correctly determine whether an application is compatible with
    147 the system, prior to installing the application. </p>
    148 
    149 <p>To use APIs introduced in Android {@sdkPlatformVersion} in your
    150 application, you need to set the proper value, "{@sdkPlatformApiLevel}", in the
    151 <code>android:minSdkVersion</code> attributes of the <code>&lt;uses-sdk&gt;</code>
    152 element in your application's manifest. </p>
    153 
    154 <p>For more information about how to use API Level, see the <a
    155 href="{@docRoot}guide/appendix/api-levels.html">API Levels</a> document. </p>
    156 
    157 
    158 <h2 id="api">Framework API Changes</h2>
    159 
    160 <p>The sections below provide information about changes made to the application
    161 framework API provided by the Android {@sdkPlatformVersion} platform.</p>
    162 
    163 <h3 id="install-loc">App installation on external storage media</h3>
    164 
    165 <p>The Android platform now allows applications to request installation onto the
    166 device's external storage media (such as the SD card), as an alternative to
    167 installation onto the device's internal memory. </p>
    168 
    169 <p>Application developers can express the preferred installation location for
    170 their applications by means of a new attribute of <code>&lt;manifest&gt;</code>
    171 in the manifest file, <a
    172 href="{@docRoot}guide/topics/manifest/manifest-element.html#install"><code>
    173 android:installLocation</code></a>. The attribute supports three values:
    174 <code>"internalOnly"</code>, <code>"preferExternal"</code>, and
    175 <code>"auto"</code>. At install time, the system checks the value of
    176 <code>android:installLocation</code> and installs the application
    177 <code>.apk</code> according to the preferred location, if possible. If the
    178 application has requested external installation, the system installs it into a
    179 private, encrypted partition in the external media. Once an application .apk is
    180 installed externally, the system lets the user change the storage location of
    181 the .apk and move it onto the device's internal memory if needed (and vice
    182 versa), through Manage Applications in the user settings.</p>
    183 
    184 <p>By default, the system installs all applications onto the device's internal
    185 memory, except for those that explicitly request external installation. This
    186 means that the system will always install legacy applications onto internal
    187 memory, since they do not have access to the
    188 <code>android:installLocation</code> attribute. However, it is possible to
    189 configure and compile a legacy application such that it is installed internally
    190 on older versions of the platform and externally on Android 2.2 and later
    191 platforms, if necessary. </p>
    192 
    193 <p>Note that requesting installation onto the device's external media is not
    194 suitable for all applications, particularly because the external media may be
    195 removable and unmounting/remounting may disrupt the user experience and system
    196 settings.</p>
    197 
    198 <p>For more information about setting a preferred install location for your
    199 application, including a discussion of what types of applications should and
    200 should not request external installation, please read the <a
    201 href="{@docRoot}guide/appendix/install-location.html">App Install Location</a>
    202 document. </p>
    203 
    204 <h3 id="backup-manager">Data backup</h3>
    205 
    206 <p>The platform now provides a generalized backup service that
    207 applications can use to backup and restore user data, to ensure that users can
    208 maintain their data when switching devices or reinstalling the application. The
    209 Backup Manager handles the work of transporting the application data to and from
    210 the backup storage area in the cloud. The Backup Manager can store any type of
    211 data, from arbitrary data to files, and manages backup and restore operations
    212 in an atomic manner. For more information, see <a
    213 href="{@docRoot}guide/topics/data/backup.html">Data Backup</a>.</p>
    214 
    215 <h3>Graphics</h3>
    216 
    217 <ul>
    218 <li>New OpenGL ES 2.0 APIs in {@link android.opengl.GLES20 android.opengl.GLES20}.</li>
    219 <li>New {@link android.opengl.ETC1}, {@link android.opengl.ETC1Util}, and {@link android.opengl.ETC1Util.ETC1Texture} classes and utility methods for using ETC1 for texture compression.</li>
    220 <li>New {@link android.graphics.ImageFormat} class.</li>
    221 <li>New {@link android.graphics.YuvImage YUV image format API} to enable compression from YUV to JPEG and manipulation of YUV data.</li>
    222 </ul>
    223 
    224 <h3>Media</h3>
    225 
    226 <ul>
    227 <li>New APIs in {@link android.media.AudioManager android.media.AudioManager} for managing audio focus, transport control, transient loss of audio focus, ducking.</li>
    228 <li>New broadcast intent for routing audio to SCO &mdash; {@link android.media.AudioManager#ACTION_SCO_AUDIO_STATE_CHANGED} with extras indicating new state.</li>
    229 <li>New APIs in {@link android.media.SoundPool} to detect completion of sound-loading.</li>
    230 <li>New APIs in {@link android.media.SoundPool} for auto pause and resume.</li>
    231 <li>New APIs in {@link android.media.MediaRecorder} for specifying audio settings for number of channels, encoding and sampling rates, sampling rate.</li>
    232 <li>New APIs for adding files to the media database, so that they are automatically scanned. See {@link android.media.MediaScannerConnection#scanFile(Context, String[], String[], OnScanCompletedListener) MediaScannerConnection.scanFile} and {@link android.media.MediaScannerConnection.OnScanCompletedListener MediaScannerConnection.OnScanCompletedListener}.</li>
    233 </ul>
    234 
    235 <h3>Speech recognition and third-party recognition engines</h3>
    236 
    237 <ul>
    238 <li>The platform provides new speech-recognition APIs that allow applications to have a richer interaction with the available voice recognizer. For example, the APIs are sufficient to integrate voice recognition deeply into an IME.</li>
    239 <li>The platform also provides a {@link android.speech.RecognitionService} base class that lets third-party developers create plug-in recognition engines. </li>
    240 <li>New {@link android.speech.RecognitionListener} interface to receive callbacks.</li>
    241 <li>New {@link android.speech.RecognizerIntent} extras that let a requester app specify details as preferred language, minimum length in milliseconds, and so on.</li>
    242 </ul>
    243 
    244 <h3>Camera and camcorder</h3>
    245 
    246 <ul>
    247 <li>Changes to camera preview API to improve efficieny of preview pipeline. </li>
    248 <li>New display orientation for camera (it can now work in portrait orientation).</li>
    249 <li>New APIs in {@link android.hardware.Camera android.hardware.Camera} for managing zoom level.</li>
    250 <li>New APIs {@link android.hardware.Camera.Parameters android.hardware.Camera.Parameters} for querying and setting device camera settings such as focal length, exposure, zoom level, view angle, and others.</li>
    251 <li>New {@link android.media.ThumbnailUtils thumbnail} utility for video and image thumbnails.</li>
    252 <li>New {@link android.media.CamcorderProfile} and {@link android.media.CamcorderProfile} classes enable apps to determine device hardware camera capablities.</li>
    253 <li>New support in {@link android.media.ExifInterface android.media.ExifInterface} for retrieving GPS and focal length.</li>
    254 </ul>
    255 
    256 <h3>Device policy manager</h3>
    257 
    258 <p>New device policy management APIs allow developers to write "device
    259 administrator" applications that can control security features of the device,
    260 such as the minimum password strength, data wipe, and so on. Users can select
    261 the administrators that are enabled on their devices. For more information, see
    262 the {@link android.app.admin android.app.admin} classees or the example
    263 application code in <a
    264 href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/DeviceAdminSample.html">DeviceAdminSample.java</a>.</p>
    265 
    266 <h3>UI Framework</h3>
    267 
    268 <ul>
    269 <li>New UI modes "car mode" and "night mode" and {@link android.app.UiModeManager} let applications adjust their application UI for specific user modes. </li>
    270 <li>New {@link android.view.ScaleGestureDetector} that lets Views detect and handle transformation gestures that involve more than one pointer (multitouch) using the supplied MotionEvents. </li>
    271 <li>Improvements in the way that multitouch events are reported in {@link android.view.MotionEvent} objects.</li>
    272 <li>The layout attribute <code>fill_parent</code> is renamed to <code>match_parent</code>. This affects both XML and Java code (see {@link android.view.ViewGroup.LayoutParams}). Note that the platform will continue to honor uses of <code>fill_parent</code> in legacy applications. </li>
    273 <li>New layout attributes {@link android.R.attr#tabStripEnabled}, {@link android.R.attr#tabStripRight}, and {@link android.R.attr#tabStripLeft} let developers customize the bottom strip of TabWidgets.</li>
    274 <li>Better support for managed dialogs in Activity.</li>
    275 </ul>
    276 
    277 <h3>Accounts and sync</h3>
    278 
    279 <ul>
    280 <li>New method {@link android.content.ContentResolver#addPeriodicSync(Account, String, Bundle, long) AddPeriodicSync()} lets you schedule a periodic sync with a specific account, authority, and extras at the given frequency.</li>
    281 </ul>
    282 
    283 <h3>New manifest elements and attributes</h3>
    284 
    285 <ul>
    286 <li>For specifying the application's preferred install location (see <a href="#install-loc">App Installation on External Storage Media</a>, above):
    287 
    288 <ul>
    289   <li>New <code>android:installLocation</code> attribute of the <code>&lt;manifest&gt;</code> element. Specifies the default install location defined by an application.</li>
    290 </ul>
    291 </li>
    292 
    293 <li>For managing user data backup (see <a href="#backup-manager">Backup manager</a>, above, for more information):
    294 
    295 <ul>
    296   <li> New <code>android:backupAgent</code> attribute of the
    297 <code>&lt;application&gt;</code> element. Specifies the component name of the 
    298 BackupAgent subclass provided by the application to handle backup/restore 
    299 operations, if any.</li>
    300   <li> New <code>android:restoreAnyVersion</code> attribute of the
    301 <code>&lt;application&gt;</code> element. Boolean value that indicates whether
    302 the application is prepared to attempt a restore of any backed-up dataset, even
    303 if the backup is apparently from a newer version of the application than is
    304 currently installed on the device.</li>
    305 </ul>
    306 </li>
    307 
    308 <li>For managing the platform's JIT compiler:
    309 
    310 <ul>
    311 <li>New <code>android:vmSafeMode</code> attribute of the <code>&lt;application&gt;</code> element. Boolean value that specifies whether to disable JIT compiler optimizations when running the application.</li>
    312 </ul>
    313 </li>
    314 </ul>
    315 
    316 <h3>Permissions</h3>
    317 
    318 <ul>
    319 <li><code>android.permission.BIND_DEVICE_ADMIN</code> &mdash; Any device administration broadcast receiver must require this permission, to ensure that only the system can interact with it.</li>
    320 <li><code>android.permission.KILL_BACKGROUND_PROCESSES</code> &mdash; Allows an application to call {@link android.app.ActivityManager#killBackgroundProcesses(String)}.
    321 <li><code>android.permission.BIND_WALLPAPER</code> &mdash; Any {@link android.service.wallpaper.WallpaperService} must require this permission, to ensure that only the system can interact with it.</li>
    322 <li><code>android.permission.SET_TIME</code> &mdash; Allows an application to set the system time.</li>
    323 </ul>
    324 
    325 <h3 id="api-diff">API differences report</h3>
    326 
    327 <p>For a detailed view of all API changes in Android {@sdkPlatformVersion} (API
    328 Level {@sdkPlatformApiLevel}), see the <a
    329 href="{@docRoot}sdk/api_diff/{@sdkPlatformApiLevel}/changes.html">API
    330 Differences Report</a>.</p>
    331 
    332 
    333 <h2 id="apps">Built-in Applications</h2>
    334 
    335 <p>The system image included in the downloadable platform provides these
    336 built-in applications:</p>
    337 
    338 <table style="border:0;padding-bottom:0;margin-bottom:0;">
    339 <tr>
    340 <td style="border:0;padding-bottom:0;margin-bottom:0;">
    341 	<ul>
    342 	<li>Alarm Clock</li>
    343 	<li>Browser</li>
    344 	<li>Calculator</li>
    345 	<li>Camera</li>
    346 	<li>Contacts</li>
    347 	<li>Custom Locale (developer app)</li>
    348 	<li>Dev Tools (developer app)</li>
    349     <li>Email</li>
    350 	</ul>
    351 </td>
    352 <td style="border:0;padding-bottom:0;margin-bottom:0;padding-left:5em;">
    353 	<ul>
    354 
    355 	<li>Gallery</li>
    356 	<li>IMEs for Japanese, Chinese, and Latin text input</li>
    357 	<li>Messaging</li>
    358 	<li>Music</li>
    359 	<li>Phone</li>
    360 	<li>Settings</li>
    361 	<li>Spare Parts (developer app)</li>
    362 	</ul>
    363 </td>
    364 </tr>
    365 </table>
    366 
    367 
    368 <h2 id="locs" style="margin-top:.75em;">Locales</h2>
    369 
    370 <p>The system image included in the downloadable platform provides a variety of
    371 built-in locales. In some cases, region-specific strings are available for the
    372 locales. In other cases, a default version of the language is used. The
    373 languages that are available in the Android {@sdkPlatformVersion} system
    374 image are listed below (with <em>language</em>_<em>country/region</em> locale
    375 descriptor).</p>
    376 
    377 <table style="border:0;padding-bottom:0;margin-bottom:0;">
    378 <tr>
    379 <td style="border:0;padding-bottom:0;margin-bottom:0;">
    380 <ul>
    381 <li>Chinese, PRC (zh_CN)</li>
    382 <li>Chinese, Taiwan (zh_TW)</li>
    383 <li>Czech (cs_CZ)</li>
    384 <li>Dutch, Netherlands (nl_NL)</li>
    385 <li>Dutch, Belgium (nl_BE)</li>
    386 <li>English, US (en_US)</li>
    387 <li>English, Britain (en_GB)</li>
    388 <li>English, Canada (en_CA)</li>
    389 <li>English, Australia (en_AU)</li>
    390 <li>English, New Zealand (en_NZ)</li>
    391 <li>English, Singapore(en_SG)</li>
    392 <li>French, France (fr_FR)</li>
    393 <li>French, Belgium (fr_BE)</li>
    394 </ul>
    395 </td>
    396 <td style="border:0;padding-bottom:0;margin-bottom:0;padding-left:5em;">
    397 <li>French, Canada (fr_CA)</li>
    398 <li>French, Switzerland (fr_CH)</li>
    399 <li>German, Germany (de_DE)</li>
    400 <li>German, Austria (de_AT)</li>
    401 <li>German, Switzerland (de_CH)</li>
    402 <li>German, Liechtenstein (de_LI)</li>
    403 <li>Italian, Italy (it_IT)</li>
    404 <li>Italian, Switzerland (it_CH)</li>
    405 <li>Japanese (ja_JP)</li>
    406 <li>Korean (ko_KR)</li>
    407 <li>Polish (pl_PL)</li>
    408 <li>Russian (ru_RU)</li>
    409 <li>Spanish (es_ES)</li>
    410 </td>
    411 </tr>
    412 </table>
    413 
    414 <p>Localized UI strings match the locales that are accessible
    415 through Settings.</p>
    416 
    417 <h2 id="skins">Emulator Skins</h2>
    418 
    419 <p>The downloadable platform includes a set of emulator skins that you can use
    420 for modeling your application in different screen sizes and resolutions. The
    421 emulator skins are:</p>
    422 
    423 <ul>
    424   <li>
    425     QVGA (240x320, low density, small screen)
    426   </li>
    427   <li>
    428     WQVGA (240x400, low density, normal screen)
    429   </li>
    430   <li>
    431     FWQVGA (240x432, low density, normal screen)
    432   </li>
    433   <li>
    434     HVGA (320x480, medium density, normal screen)
    435   </li>
    436   <li>
    437     WVGA800 (480x800, high density, normal screen)
    438   </li>
    439   <li>
    440     WVGA854 (480x854 high density, normal screen)
    441   </li>
    442 </ul>
    443 
    444 <p>For more information about how to develop an application that displays
    445 and functions properly on all Android-powered devices, see <a
    446 href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple
    447 Screens</a>.</p>