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