diff options
author | Scott Main <smain@google.com> | 2009-07-31 14:22:02 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2009-07-31 14:22:02 -0700 |
commit | e4522404930e49e251deb414776069cf09072d89 (patch) | |
tree | 0beca90f266c2fdf7913d29c13b261feb63a29c5 /docs | |
parent | 13f17c95156568f4a15e1d1f71af6bf6e55366dc (diff) | |
parent | af09b67f31195340623ced993f71c8b1a248b9a3 (diff) | |
download | frameworks_base-e4522404930e49e251deb414776069cf09072d89.zip frameworks_base-e4522404930e49e251deb414776069cf09072d89.tar.gz frameworks_base-e4522404930e49e251deb414776069cf09072d89.tar.bz2 |
am af09b67f: add api level doc to the appendix
Merge commit 'af09b67f31195340623ced993f71c8b1a248b9a3'
* commit 'af09b67f31195340623ced993f71c8b1a248b9a3':
add api level doc to the appendix
Diffstat (limited to 'docs')
-rw-r--r-- | docs/html/guide/appendix/api-levels.jd | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/docs/html/guide/appendix/api-levels.jd b/docs/html/guide/appendix/api-levels.jd new file mode 100644 index 0000000..9af0918 --- /dev/null +++ b/docs/html/guide/appendix/api-levels.jd @@ -0,0 +1,79 @@ +page.title=Android API Levels +@jd:body + + +<p>The Android <em>API Level</em> is an integer that indicates a set of APIs available in an Android SDK +and on a version of the Android platform. Each version of the Android platform supports a specific set +of APIs, which are always backward-compatible. For example, Android 1.5 supports all APIs available in +Android 1.0, but the reverse is not true. If an application uses APIs +available in Android 1.5 that are not available in 1.0, then the application should never be installed +on an Android 1.0 device, because it will fail due to missing APIs. The API Level ensures this does not happen +by comparing the minimum API Level required by the applicaiton to the API Level available on the device.</p> + +<p>When a new version of Android adds APIs, a new API Level is added to the platform. The new APIs +are available only to applications that declare a minimum API Level that is equal-to or greater-than +the API Level in which the APIs were introduced. The API Level required by an application is declared with the +<code><uses-sdk></code> element inside the Android manifest, like this:</p> + +<pre><uses-sdk android:minSdkVersion="3" /></pre> + +<p>The value for <code>minSdkVersion</code> is the minimum API Level required by the application. +If this is not declared, then it is assumed that the application is compatible with all versions and defaults to +API Level 1. In which case, if the application actually uses APIs introduced with an API Level greater than 1, then +the application will fail in unpredictable ways when installed on a device that only supports API Level 1 +(such as an Android 1.0 device). +See the <code><a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html"><uses-sdk></a></code> +documentation for more about declaring the API Level in your manifest.</p> + +<p>For example, the {@link android.appwidget} package was introduced with API Level 3. If your application +has set <code>minSdkVersion</code> to 1 or 2, then your application cannot use this package, +even if the device running your application uses a version of Android that supports it. +In order to use the {@link android.appwidget} package, your application must set <code>minSdkVersion</code> +to 3 or higher. When the <code>minSdkVersion</code> is set to 3, the application will no longer be able to install +on a device running a platform version with an API Level less than 3.</p> + +<p>Despite the name of the manifest attribute (<code>minSdkVersion</code>), the API Level is not directly +associated with a specific SDK. For example, the SDK for Android 1.0 uses +API Level 1 and the SDK for Android 1.1 uses API Level 2. So it may seem that the API Level increases consistently. +However, it's possible that a subsequent platform +releases will not introduce new APIs, and thus, the API Level will remain the same. In addition, there are often +multiple SDK releases for a single platform version (there were three SDK releases for Android 1.5), and +there's no guarantee that the API Level will remain the same between these. It's possible (but unlikely) that +a second or third SDK for a given version of the platform will provide new APIs and add a new API Level. +When you install a new SDK, be sure to read the SDK Contents on the install page, which specifies the API +Level for each platform available in the SDK. Also see the comparison of +<a href="#VersionsVsApiLevels">Platform Versions vs. API Levels</a>, below.</p> + +<p class="note"><strong>Note:</strong> During "preview" SDK releases, there may not yet be an official platform version +or API Level number specified. In these cases, a string value equal to the +current codename will be a valid value for <code>minSdkVersion</code>, instead of an integer. This codename value +will only be valid while using the preview SDK. When the final SDK is released, you must update your manifest to use +the official API Level integer.</p> + +<h2 id="VersionsVsApiLevels">Platform Versions vs. API Levels</h2> + +<p>The following table specifies the <em>maximum</em> API Level supported by each version of the Android platform.</p> + +<table> + <tr><th>Platform Version</th><th>API Level</th></tr> + <tr><td>Android 1.0</td><td>1</td></tr> + <tr><td>Android 1.1</td><td>2</td></tr> + <tr><td>Android 1.5</td><td>3</td></tr> + <tr><td>Android Donut</td><td>Donut</td></tr> +</table> + + +<h2 id="ViewingTheApiReference">Viewing the API Reference Based on API Level</h2> + +<p>The Android API reference includes information that specififies the minimum API Level required for each +package, class, and member. You can see this information on the right side of each header or label.</p> + +<p>By default, the reference documentation shows all APIs available with the latest SDK release. +This means that the reference assumes you're using the latest API Level and will show you everything available +with it. If you're developing applications for a version of Android that does not support the latest API Level, +then you can filter the reference to reveal only the packages, classes, and members available for that API Level. +When viewing the reference, use the "Filter by API Level" selection box (below the search bar) to pick the API Level +you'd like to view.</p> + + + |