*API Level:* **8**

Android 2.2 is a minor platform release including user
features, developer features, API changes, and bug
fixes. For information on developer features and API changes, see the
[Framework API](https://developer.android.com/about/versions/android-2.2#api) section.

For developers, the Android 2.2 platform is available as a
downloadable component for the Android SDK. The downloadable platform includes
an Android library and system image, as well as a set of emulator skins and
more. To get started developing or testing against Android 2.2,
use the Android SDK Manager to download the platform into your SDK.

## Platform Highlights

For a list of new user features and platform highlights, see the [Android
2.2 Platform Highlights](https://developer.android.com/about/versions/android-2.2-highlights.html) document.

## API Level

The Android 2.2 platform delivers an updated version of
the framework API. The Android 2.2 API
is assigned an integer identifier ---
**8** --- that is
stored in the system itself. This identifier, called the "API Level", allows the
system to correctly determine whether an application is compatible with
the system, prior to installing the application.

To use APIs introduced in Android 2.2 in your
application, you need to set the proper value, "8", in the
`android:minSdkVersion` attributes of the `<uses-sdk>`
element in your application's manifest.

For more information about how to use API Level, see the [API Levels](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) document.

## Framework API Changes

The sections below provide information about changes made to the application
framework API provided by the Android 2.2 platform.

### App installation on external storage media

The Android platform now allows applications to request installation onto the
device's external storage media (such as the SD card), as an alternative to
installation onto the device's internal memory.

Application developers can express the preferred installation location for
their applications by means of a new attribute of `<manifest>`
in the manifest file, [`
android:installLocation`](https://developer.android.com/guide/topics/manifest/manifest-element#install). The attribute supports three values:
`"internalOnly"`, `"preferExternal"`, and
`"auto"`. At install time, the system checks the value of
`android:installLocation` and installs the application
`.apk` according to the preferred location, if possible. If the
application has requested external installation, the system installs it into a
private, encrypted partition in the external media. Once an application .apk is
installed externally, the system lets the user change the storage location of
the .apk and move it onto the device's internal memory if needed (and vice
versa), through Manage Applications in the user settings.

By default, the system installs all applications onto the device's internal
memory, except for those that explicitly request external installation. This
means that the system will always install legacy applications onto internal
memory, since they do not have access to the
`android:installLocation` attribute. However, it is possible to
configure and compile a legacy application such that it is installed internally
on older versions of the platform and externally on Android 2.2 and later
platforms, if necessary.

Note that requesting installation onto the device's external media is not
suitable for all applications, particularly because the external media may be
removable and unmounting/remounting may disrupt the user experience and system
settings.

For more information about setting a preferred install location for your
application, including a discussion of what types of applications should and
should not request external installation, please read the [App Install Location](https://developer.android.com/guide/topics/data/install-location)
document.

### Data backup

The platform now provides a generalized backup service that
applications can use to backup and restore user data, to ensure that users can
maintain their data when switching devices or reinstalling the application. The
Backup Manager handles the work of transporting the application data to and from
the backup storage area in the cloud. The Backup Manager can store any type of
data, from arbitrary data to files, and manages backup and restore operations
in an atomic manner. For more information, see [Data Backup](https://developer.android.com/guide/topics/data/backup).

### Graphics

- New OpenGL ES 2.0 APIs in [android.opengl.GLES20](https://developer.android.com/reference/android/opengl/GLES20).
- New [ETC1](https://developer.android.com/reference/android/opengl/ETC1), [ETC1Util](https://developer.android.com/reference/android/opengl/ETC1Util), and [ETC1Util.ETC1Texture](https://developer.android.com/reference/android/opengl/ETC1Util.ETC1Texture) classes and utility methods for using ETC1 for texture compression.
- New [ImageFormat](https://developer.android.com/reference/android/graphics/ImageFormat) class.
- New [YUV image format API](https://developer.android.com/reference/android/graphics/YuvImage) to enable compression from YUV to JPEG and manipulation of YUV data.

### Media

- New APIs in [android.media.AudioManager](https://developer.android.com/reference/android/media/AudioManager) for managing audio focus, transport control, transient loss of audio focus, ducking.
- New broadcast intent for routing audio to SCO --- [ACTION_SCO_AUDIO_STATE_CHANGED](https://developer.android.com/reference/android/media/AudioManager#ACTION_SCO_AUDIO_STATE_CHANGED) with extras indicating new state.
- New APIs in [SoundPool](https://developer.android.com/reference/android/media/SoundPool) to detect completion of sound-loading.
- New APIs in [SoundPool](https://developer.android.com/reference/android/media/SoundPool) for auto pause and resume.
- New APIs in [MediaRecorder](https://developer.android.com/reference/android/media/MediaRecorder) for specifying audio settings for number of channels, encoding and sampling rates, sampling rate.
- New APIs for adding files to the media database, so that they are automatically scanned. See [MediaScannerConnection.scanFile](https://developer.android.com/reference/android/media/MediaScannerConnection#scanFile(android.content.Context, java.lang.String[], java.lang.String[], android.media.MediaScannerConnection.OnScanCompletedListener)) and [MediaScannerConnection.OnScanCompletedListener](https://developer.android.com/reference/android/media/MediaScannerConnection.OnScanCompletedListener).

### Speech recognition and third-party recognition engines

- 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.
- The platform also provides a [RecognitionService](https://developer.android.com/reference/android/speech/RecognitionService) base class that lets third-party developers create plug-in recognition engines.
- New [RecognitionListener](https://developer.android.com/reference/android/speech/RecognitionListener) interface to receive callbacks.
- New [RecognizerIntent](https://developer.android.com/reference/android/speech/RecognizerIntent) extras that let a requester app specify details as preferred language, minimum length in milliseconds, and so on.

### Camera and camcorder

- Changes to camera preview API to improve efficieny of preview pipeline.
- New display orientation for camera (it can now work in portrait orientation).
- New APIs in [android.hardware.Camera](https://developer.android.com/reference/android/hardware/Camera) for managing zoom level.
- New APIs [android.hardware.Camera.Parameters](https://developer.android.com/reference/android/hardware/Camera.Parameters) for querying and setting device camera settings such as focal length, exposure, zoom level, view angle, and others.
- New [thumbnail](https://developer.android.com/reference/android/media/ThumbnailUtils) utility for video and image thumbnails.
- New [CamcorderProfile](https://developer.android.com/reference/android/media/CamcorderProfile) and [CamcorderProfile](https://developer.android.com/reference/android/media/CamcorderProfile) classes enable apps to determine device hardware camera capabilities.
- New support in [android.media.ExifInterface](https://developer.android.com/reference/android/media/ExifInterface) for retrieving GPS and focal length.

### Device policy manager

New device policy management APIs allow developers to write "device
administrator" applications that can control security features of the device,
such as the minimum password strength, data wipe, and so on. Users can select
the administrators that are enabled on their devices. For more information, see
the [android.app.admin](https://developer.android.com/reference/android/app/admin/package-summary) classees or the example
application code in [DeviceAdminSample.java](https://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/DeviceAdminSample).

### UI Framework

- New UI modes "car mode" and "night mode" and [UiModeManager](https://developer.android.com/reference/android/app/UiModeManager) let applications adjust their application UI for specific user modes.
- New [ScaleGestureDetector](https://developer.android.com/reference/android/view/ScaleGestureDetector) that lets Views detect and handle transformation gestures that involve more than one pointer (multitouch) using the supplied MotionEvents.
- Improvements in the way that multitouch events are reported in [MotionEvent](https://developer.android.com/reference/android/view/MotionEvent) objects.
- The layout attribute `fill_parent` is renamed to `match_parent`. This affects both XML and Java code (see [ViewGroup.LayoutParams](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams)). Note that the platform will continue to honor uses of `fill_parent` in legacy applications.
- New layout attributes [tabStripEnabled](https://developer.android.com/reference/android/R.attr#tabStripEnabled), [tabStripRight](https://developer.android.com/reference/android/R.attr#tabStripRight), and [tabStripLeft](https://developer.android.com/reference/android/R.attr#tabStripLeft) let developers customize the bottom strip of TabWidgets.
- Better support for managed dialogs in Activity.

### Accounts and sync

- New method [AddPeriodicSync()](https://developer.android.com/reference/android/content/ContentResolver#addPeriodicSync(android.accounts.Account, java.lang.String, android.os.Bundle, long)) lets you schedule a periodic sync with a specific account, authority, and extras at the given frequency.

### New manifest elements and attributes

- For specifying the application's preferred install location (see [App Installation on External Storage Media](https://developer.android.com/about/versions/android-2.2#install-loc), above):
  - New `android:installLocation` attribute of the `<manifest>` element. Specifies the default install location defined by an application.
- For managing user data backup (see [Backup manager](https://developer.android.com/about/versions/android-2.2#backup-manager), above, for more information):
  - New `android:backupAgent` attribute of the `<application>` element. Specifies the component name of the BackupAgent subclass provided by the application to handle backup/restore operations, if any.
  - New `android:restoreAnyVersion` attribute of the `<application>` element. Boolean value that indicates whether the application is prepared to attempt a restore of any backed-up dataset, even if the backup is apparently from a newer version of the application than is currently installed on the device.
- For managing the platform's JIT compiler:
  - New `android:vmSafeMode` attribute of the `<application>` element. Boolean value that specifies whether to disable JIT compiler optimizations when running the application.

### Permissions

- `android.permission.BIND_DEVICE_ADMIN` --- Any device administration broadcast receiver must require this permission, to ensure that only the system can interact with it.
- `android.permission.KILL_BACKGROUND_PROCESSES` --- Allows an application to call [killBackgroundProcesses(String)](https://developer.android.com/reference/android/app/ActivityManager#killBackgroundProcesses(java.lang.String)).
- `android.permission.BIND_WALLPAPER` --- Any [WallpaperService](https://developer.android.com/reference/android/service/wallpaper/WallpaperService) must require this permission, to ensure that only the system can interact with it.
- `android.permission.SET_TIME` --- Allows an application to set the system time.

### API differences report

For a detailed view of all API changes in Android 2.2 (API
Level 8), see the [API
Differences Report](https://developer.android.com/sdk/api_diff/8/changes).