blob: 82bb78fa14f910185de46cc786896fcd9777368d [file] [log] [blame]
page.title=Android 2.0, Release 1
excludeFromSuggestions=true
sdk.platform.version=2.0
sdk.platform.apiLevel=5
sdk.platform.majorMinor=major
@jd:body
<div id="qv-wrapper">
<div id="qv">
<h2>In this document</h2>
<ol>
<li><a href="#features">Platform Highlights</a></li>
<li><a href="#relnotes">Revisions</a></li>
<li><a href="#apps">Built-in Applications</a></li>
<li><a href="#locs">Locales</a></li>
<li><a href="#skins">Emulator Skins</a></li>
<li><a href="#dev-features">Developer Features</a></li>
<li><a href="#api">Framework API</a>
<ol>
<li><a href="#api-level">API level</a></li>
<li><a href="#api-changes">API changes summary</a></li>
<li><a href="{@docRoot}sdk/api_diff/{@sdkPlatformApiLevel}/changes.html">API differences report &raquo;</a> </li>
</ol></li>
</ol>
<h2>See Also</h2>
<ol>
<li><a href="{@docRoot}sdk/exploring.html">Exploring the SDK</a></li>
</ol>
</div>
</div>
<p>
<em>API Level:</em>&nbsp;<strong>{@sdkPlatformApiLevel}</strong></p>
<p>Android {@sdkPlatformVersion} is a {@sdkPlatformMajorMinor} platform release
deployable to Android-powered handsets starting in November 2009.
The release includes new features for users and developers, as well as changes
in the Android framework API. </p>
<p>For developers, the Android {@sdkPlatformVersion} platform is available as a
downloadable component for the Android SDK. The downloadable platform includes a
fully compliant Android library and system image, as well as a set of emulator
skins, sample applications, and more. The downloadable platform is fully
compliant and includes no external libraries. </p>
<p>To get started developing or testing against the Android
{@sdkPlatformVersion} platform, use the Android SDK and AVD Manager tool to
download the platform into your SDK. For more information,
see <a href="{@docRoot}sdk/exploring.html">Exploring the
SDK</a>.</p>
<h2 id="features">Platform Highlights</h2>
<p>For a list of new user features and platform highlights, see the <a
href="http://developer.android.com/about/versions/android-{@sdkPlatformVersion}-highlights.html">Android
{@sdkPlatformVersion} Platform Highlights</a> document.</p>
<h2 id="relnotes">Revisions</h2>
<p>The sections below provide notes about successive releases of
the Android {@sdkPlatformVersion} platform component for the Android SDK, as denoted by
revision number. To determine what revision(s) of the Android
{@sdkPlatformVersion} platforms are installed in your SDK environment, refer to
the "Installed Packages" listing in the Android SDK and AVD Manager.</p>
<script type="text/javascript">
function toggleDiv(link) {
var toggleable = $(link).parent();
if (toggleable.hasClass("closed")) {
//$(".toggleme", toggleable).slideDown("fast");
toggleable.removeClass("closed");
toggleable.addClass("open");
$(".toggle-img", toggleable).attr("title", "hide").attr("src", (toRoot + "assets/images/triangle-opened.png"));
} else {
//$(".toggleme", toggleable).slideUp("fast");
toggleable.removeClass("open");
toggleable.addClass("closed");
$(".toggle-img", toggleable).attr("title", "show").attr("src", (toRoot + "assets/images/triangle-closed.png"));
}
return false;
}
</script>
<style>
.toggleable {
padding: .25em 1em;
}
.toggleme {
padding: 1em 1em 0 2em;
line-height:1em;
}
.toggleable a {
text-decoration:none;
}
.toggleable.closed .toggleme {
display:none;
}
#jd-content .toggle-img {
margin:0;
}
</style>
<div class="toggleable opened">
<a href="#" onclick="return toggleDiv(this)">
<img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-img" height="9px" width="9px" />
Android 2.0, Revision 1</a> <em>(October 2009)</em></a>
<div class="toggleme">
<dl>
<dt>Dependencies:</dt>
<dd>
<p>Requires SDK Tools r3 or higher.</p>
</dd>
</dl>
</div>
</div>
<h2 id="apps">Built-in Applications</h2>
<p>The system image included in the downloadable platform provides these
built-in applications:</p>
<table style="border:0;padding-bottom:0;margin-bottom:0;">
<tr>
<td style="border:0;padding-bottom:0;margin-bottom:0;">
<ul>
<li>Alarm Clock</li>
<li>Browser</li>
<li>Calculator</li>
<li>Camcorder</li>
<li>Camera</li>
<li>Contacts</li>
<li>Custom Locale (developer app)</li>
<li>Dev Tools (developer app)</li>
<li>Dialer</li>
</ul>
</td>
<td style="border:0;padding-bottom:0;margin-bottom:0;padding-left:5em;">
<ul>
<li>Email</li>
<li>Gallery</li>
<li>Gestures Builder</li>
<li>IME for Japanese text input</li>
<li>Messaging</li>
<li>Music</li>
<li>Settings</li>
<li>Spare Parts (developer app)</li>
</ul>
</td>
</tr>
</table>
<h2 id="locs" style="margin-top:.75em;">Locales</h2>
<p>The system image included in the downloadable platform provides a variety of
built-in locales. In some cases, region-specific strings are available for the
locales. In other cases, a default version of the language is used. The
languages that are available in the Android {@sdkPlatformVersion} system
image are listed below (with <em>language</em>_<em>country/region</em> locale
descriptor).</p>
<table style="border:0;padding-bottom:0;margin-bottom:0;">
<tr>
<td style="border:0;padding-bottom:0;margin-bottom:0;">
<ul>
<li>Chinese, PRC (zh_CN)</li>
<li>Chinese, Taiwan (zh_TW)</li>
<li>Czech (cs_CZ)</li>
<li>Dutch, Netherlands (nl_NL)</li>
<li>Dutch, Belgium (nl_BE)</li>
<li>English, US (en_US)</li>
<li>English, Britain (en_GB)</li>
<li>English, Canada (en_CA)</li>
<li>English, Australia (en_AU)</li>
<li>English, New Zealand (en_NZ)</li>
<li>English, Singapore(en_SG)</li>
<li>French, France (fr_FR)</li>
<li>French, Belgium (fr_BE)</li>
</ul>
</td>
<td style="border:0;padding-bottom:0;margin-bottom:0;padding-left:5em;">
<li>French, Canada (fr_CA)</li>
<li>French, Switzerland (fr_CH)</li>
<li>German, Germany (de_DE)</li>
<li>German, Austria (de_AT)</li>
<li>German, Switzerland (de_CH)</li>
<li>German, Liechtenstein (de_LI)</li>
<li>Italian, Italy (it_IT)</li>
<li>Italian, Switzerland (it_CH)</li>
<li>Japanese (ja_JP)</li>
<li>Korean (ko_KR)</li>
<li>Polish (pl_PL)</li>
<li>Russian (ru_RU)</li>
<li>Spanish (es_ES)</li>
</td>
</tr>
</table>
<p>Localized UI strings match the locales that are accessible
through Settings.</p>
<h2 id="skins">Emulator Skins</h2>
<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>
<ul>
<li>
QVGA (240x320, low density, small screen)
</li>
<li>
WQVGA (240x400, low density, normal screen)
</li>
<li>
FWQVGA (240x432, low density, normal screen)
</li>
<li>
HVGA (320x480, medium density, normal screen)
</li>
<li>
WVGA800 (480x800, high density, normal screen)
</li>
<li>
WVGA854 (480x854 high density, normal screen)
</li>
</ul>
<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>
<h2 id="dev-features">Developer Features</h2>
<p>The sections below provide information about new developer features offered by the downloadable Android 2.0 platform component.</p>
<h3 id="ant">Ant Support</h3>
<ul>
<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}tools/publishing/app-signing.html#releasecompile">Signing Your Applications</a>.</li>
<li>Adds new Ant build system with support for Emma instrumentation projects (code coverage).</li>
</ul>
<h2 id="api">Framework API</h2>
<p>The sections below provide information about the application framework API provided by the Android {@sdkPlatformVersion} platform. </p>
<h3 id="api-level">API level</h3>
<p>The Android {@sdkPlatformVersion} platform delivers an updated version of the framework
API. As with previous versions, the Android {@sdkPlatformVersion} API
is assigned an integer identifier &mdash; <strong>{@sdkPlatformApiLevel}</strong> &mdash; 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. </p>
<p>To use APIs introduced in Android {@sdkPlatformVersion} in your application, you need to
set the proper value, "{@sdkPlatformApiLevel}", in the attributes of the <code>&lt;uses-sdk&gt;</code>
element in your application's manifest. </p>
<p>For more information about how to use API Level, see the <a
href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#ApiLevels">API Levels</a> document. </p>
<h3 id="api-changes">API changes summary</h3>
<h4>Bluetooth</h4>
<ul>
<li>Turn on/off Bluetooth</li>
<li>Device and service discovery</li>
<li>Connect to a remote device using RFCOMM and send/receive data</li>
<li>Advertise RFCOMM services and listen for incoming RFCOMM connection</li>
</ul>
<h4>Sync adapters </h4>
<ul>
<li>New APIs for sync adapters to connect to any backend</li>
</ul>
<h4>Account Manager</h4>
<ul>
<li>Centralized account manager API to securely store and access auth tokens/passwords </li>
</ul>
<h4>Contacts</h4>
<ul>
<li>New contacts APIs that allow for data from multiple accounts</li>
<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>
</ul>
<h4>WebView</h4>
<ul>
<li>Deprecated classes: UrlInterceptHandler, Plugin, PluginData, PluginList, UrlInterceptRegistry.</li>
</ul>
<h4>Camera</h4>
<ul>
<li>New parameters for color effect, scene mode, flash mode, focus mode, white balance, rotation, and other settings.</li>
<li>New ZoomCallback interface to perform actions when the zoom level has changed.</li>
</ul>
<h4>Media</h4>
<ul>
<li>MediaScanner now generates thumbnails for all images when they are inserted into MediaStore.</li>
<li>New Thumbnail API for retrieving image and video thumbnails on demand.</li>
</ul>
<h4>Other Framework</h4>
<ul>
<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>
<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>
<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.
<ul>
<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>
</ul>
</li>
<li>MotionEvent can now report simultaneous-touch information for devices that support it. Up to three pointers can be tracked simultaneously. </li>
<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>
<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>
<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>
</ul>
<h4>Key events executed on key-up</h4>
<p>Android 2.0 is designed to run on devices that use virtual keys for HOME,
MENU, BACK, and SEARCH, rather than physical keys. To support the best user
experience on those devices, the Android platform now executes these buttons at
key-up, for a key-down/key-up pair, rather than key-down. This helps prevent
accidental button events and lets the user press the button area and then drag
out of it without generating an event. </p>
<p>This change in behavior should only affect your application if it is
intercepting button events and taking an action on key-down, rather than on
key-up. Especially if your application is intercepting the BACK key, you should
make sure that your application is handling the key events properly. </p>
<p>In general, intercepting the BACK key in an application is not recommended,
however, if your application is doing so and it invokes some action on
key-down, rather than key-up, you should modify your code. </p>
<p>If your application will use APIs introduced in Android 2.0 (API Level 5),
you can take advantage of new APIs for managing key-event pairs:</p>
<ul>
<li>If you are intercepting the BACK key in an activity or dialog, just
implement the new {@link android.app.Activity#onBackPressed()} method. </li>
<li>If you are intercepting the BACK key in a view, you should track the key
event on key-down (through the new {@link android.view.KeyEvent#startTracking}
method), then invoke the action at key up. Here's a pattern you can use:</li>
<pre> public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK
&& event.getRepeatCount() == 0) {
event.startTracking();
return true;
}
return super.onKeyDown(keyCode, event);
}
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking()
&& !event.isCanceled()) {
// *** DO ACTION HERE ***
return true;
}
return super.onKeyUp(keyCode, event);
}</pre>
</ul>
<p>If you want to update a legacy application so that its handling of the BACK
key works properly for both Android 2.0 and older platform versions, you
can use an approach similar to that shown above. Your code can catch the
target button event on key-down, set a flag to track the key event, and
then also catch the event on key-up, executing the desired action if the tracking
flag is set. You'll also want to watch for focus changes and clear the tracking
flag when gaining/losing focus.</p>
<h3 id="api-diff">API differences report</h3>
<p>For a detailed view of API changes in Android {@sdkPlatformVersion} (API Level {@sdkPlatformApiLevel}), as compared to
the previous version, see the <a
href="{@docRoot}sdk/api_diff/{@sdkPlatformApiLevel}/changes.html">API Differences Report</a>.</p>