• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1page.title=Android 2.2 APIs
2excludeFromSuggestions=true
3sdk.platform.version=2.2
4sdk.platform.apiLevel=8
5sdk.platform.majorMinor=minor
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="#api-level">API Level</a></li>
16  <li><a href="#api">Framework API Changes</a>
17
18    </ol>
19  </li>
20</ol>
21
22<h2>Reference</h2>
23<ol>
24<li><a
25href="{@docRoot}sdk/api_diff/{@sdkPlatformApiLevel}/changes.html">API
26Differences Report &raquo;</a> </li>
27</ol>
28
29</div>
30</div>
31
32<p>
33<em>API Level:</em>&nbsp;<strong>{@sdkPlatformApiLevel}</strong></p>
34
35<p>Android {@sdkPlatformVersion} is a {@sdkPlatformMajorMinor} platform release including user
36features, developer features, API changes, and bug
37fixes. For  information on developer features and API changes, see the
38<a href="#api">Framework API</a> section.</p>
39
40<p>For developers, the Android {@sdkPlatformVersion} platform is available as a
41downloadable component for the Android SDK. The downloadable platform includes
42an Android library and system image, as well as a set of emulator skins and
43more. To get started developing or testing against Android {@sdkPlatformVersion},
44use the Android SDK Manager to download the platform into your SDK.</p>
45
46
47<h2 id="features">Platform Highlights</h2>
48
49<p>For a list of new user features and platform highlights, see the <a
50href="http://developer.android.com/about/versions/android-2.2-highlights.html">Android
512.2 Platform Highlights</a> document.</p>
52
53
54<h2 id="api-level">API Level</h2>
55
56<p>The Android {@sdkPlatformVersion} platform delivers an updated version of
57the framework API. The Android {@sdkPlatformVersion} API
58is assigned an integer identifier &mdash;
59<strong>{@sdkPlatformApiLevel}</strong> &mdash; that is
60stored in the system itself. This identifier, called the "API Level", allows the
61system to correctly determine whether an application is compatible with
62the system, prior to installing the application. </p>
63
64<p>To use APIs introduced in Android {@sdkPlatformVersion} in your
65application, you need to set the proper value, "{@sdkPlatformApiLevel}", in the
66<code>android:minSdkVersion</code> attributes of the <code>&lt;uses-sdk&gt;</code>
67element in your application's manifest. </p>
68
69<p>For more information about how to use API Level, see the <a
70href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#ApiLevels">API Levels</a> document. </p>
71
72
73<h2 id="api">Framework API Changes</h2>
74
75<p>The sections below provide information about changes made to the application
76framework API provided by the Android {@sdkPlatformVersion} platform.</p>
77
78<h3 id="install-loc">App installation on external storage media</h3>
79
80<p>The Android platform now allows applications to request installation onto the
81device's external storage media (such as the SD card), as an alternative to
82installation onto the device's internal memory. </p>
83
84<p>Application developers can express the preferred installation location for
85their applications by means of a new attribute of <code>&lt;manifest&gt;</code>
86in the manifest file, <a
87href="{@docRoot}guide/topics/manifest/manifest-element.html#install"><code>
88android:installLocation</code></a>. The attribute supports three values:
89<code>"internalOnly"</code>, <code>"preferExternal"</code>, and
90<code>"auto"</code>. At install time, the system checks the value of
91<code>android:installLocation</code> and installs the application
92<code>.apk</code> according to the preferred location, if possible. If the
93application has requested external installation, the system installs it into a
94private, encrypted partition in the external media. Once an application .apk is
95installed externally, the system lets the user change the storage location of
96the .apk and move it onto the device's internal memory if needed (and vice
97versa), through Manage Applications in the user settings.</p>
98
99<p>By default, the system installs all applications onto the device's internal
100memory, except for those that explicitly request external installation. This
101means that the system will always install legacy applications onto internal
102memory, since they do not have access to the
103<code>android:installLocation</code> attribute. However, it is possible to
104configure and compile a legacy application such that it is installed internally
105on older versions of the platform and externally on Android 2.2 and later
106platforms, if necessary. </p>
107
108<p>Note that requesting installation onto the device's external media is not
109suitable for all applications, particularly because the external media may be
110removable and unmounting/remounting may disrupt the user experience and system
111settings.</p>
112
113<p>For more information about setting a preferred install location for your
114application, including a discussion of what types of applications should and
115should not request external installation, please read the <a
116href="{@docRoot}guide/topics/data/install-location.html">App Install Location</a>
117document. </p>
118
119<h3 id="backup-manager">Data backup</h3>
120
121<p>The platform now provides a generalized backup service that
122applications can use to backup and restore user data, to ensure that users can
123maintain their data when switching devices or reinstalling the application. The
124Backup Manager handles the work of transporting the application data to and from
125the backup storage area in the cloud. The Backup Manager can store any type of
126data, from arbitrary data to files, and manages backup and restore operations
127in an atomic manner. For more information, see <a
128href="{@docRoot}guide/topics/data/backup.html">Data Backup</a>.</p>
129
130<h3>Graphics</h3>
131
132<ul>
133<li>New OpenGL ES 2.0 APIs in {@link android.opengl.GLES20 android.opengl.GLES20}.</li>
134<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>
135<li>New {@link android.graphics.ImageFormat} class.</li>
136<li>New {@link android.graphics.YuvImage YUV image format API} to enable compression from YUV to JPEG and manipulation of YUV data.</li>
137</ul>
138
139<h3>Media</h3>
140
141<ul>
142<li>New APIs in {@link android.media.AudioManager android.media.AudioManager} for managing audio focus, transport control, transient loss of audio focus, ducking.</li>
143<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>
144<li>New APIs in {@link android.media.SoundPool} to detect completion of sound-loading.</li>
145<li>New APIs in {@link android.media.SoundPool} for auto pause and resume.</li>
146<li>New APIs in {@link android.media.MediaRecorder} for specifying audio settings for number of channels, encoding and sampling rates, sampling rate.</li>
147<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>
148</ul>
149
150<h3>Speech recognition and third-party recognition engines</h3>
151
152<ul>
153<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>
154<li>The platform also provides a {@link android.speech.RecognitionService} base class that lets third-party developers create plug-in recognition engines. </li>
155<li>New {@link android.speech.RecognitionListener} interface to receive callbacks.</li>
156<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>
157</ul>
158
159<h3>Camera and camcorder</h3>
160
161<ul>
162<li>Changes to camera preview API to improve efficieny of preview pipeline. </li>
163<li>New display orientation for camera (it can now work in portrait orientation).</li>
164<li>New APIs in {@link android.hardware.Camera android.hardware.Camera} for managing zoom level.</li>
165<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>
166<li>New {@link android.media.ThumbnailUtils thumbnail} utility for video and image thumbnails.</li>
167<li>New {@link android.media.CamcorderProfile} and {@link android.media.CamcorderProfile} classes enable apps to determine device hardware camera capablities.</li>
168<li>New support in {@link android.media.ExifInterface android.media.ExifInterface} for retrieving GPS and focal length.</li>
169</ul>
170
171<h3>Device policy manager</h3>
172
173<p>New device policy management APIs allow developers to write "device
174administrator" applications that can control security features of the device,
175such as the minimum password strength, data wipe, and so on. Users can select
176the administrators that are enabled on their devices. For more information, see
177the {@link android.app.admin android.app.admin} classees or the example
178application code in <a
179href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/DeviceAdminSample.html">DeviceAdminSample.java</a>.</p>
180
181<h3>UI Framework</h3>
182
183<ul>
184<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>
185<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>
186<li>Improvements in the way that multitouch events are reported in {@link android.view.MotionEvent} objects.</li>
187<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>
188<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>
189<li>Better support for managed dialogs in Activity.</li>
190</ul>
191
192<h3>Accounts and sync</h3>
193
194<ul>
195<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>
196</ul>
197
198<h3>New manifest elements and attributes</h3>
199
200<ul>
201<li>For specifying the application's preferred install location (see <a href="#install-loc">App Installation on External Storage Media</a>, above):
202
203<ul>
204  <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>
205</ul>
206</li>
207
208<li>For managing user data backup (see <a href="#backup-manager">Backup manager</a>, above, for more information):
209
210<ul>
211  <li> New <code>android:backupAgent</code> attribute of the
212<code>&lt;application&gt;</code> element. Specifies the component name of the
213BackupAgent subclass provided by the application to handle backup/restore
214operations, if any.</li>
215  <li> New <code>android:restoreAnyVersion</code> attribute of the
216<code>&lt;application&gt;</code> element. Boolean value that indicates whether
217the application is prepared to attempt a restore of any backed-up dataset, even
218if the backup is apparently from a newer version of the application than is
219currently installed on the device.</li>
220</ul>
221</li>
222
223<li>For managing the platform's JIT compiler:
224
225<ul>
226<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>
227</ul>
228</li>
229</ul>
230
231<h3>Permissions</h3>
232
233<ul>
234<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>
235<li><code>android.permission.KILL_BACKGROUND_PROCESSES</code> &mdash; Allows an application to call {@link android.app.ActivityManager#killBackgroundProcesses(String)}.
236<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>
237<li><code>android.permission.SET_TIME</code> &mdash; Allows an application to set the system time.</li>
238</ul>
239
240<h3 id="api-diff">API differences report</h3>
241
242<p>For a detailed view of all API changes in Android {@sdkPlatformVersion} (API
243Level {@sdkPlatformApiLevel}), see the <a
244href="{@docRoot}sdk/api_diff/{@sdkPlatformApiLevel}/changes.html">API
245Differences Report</a>.</p>
246
247
248
249