Android SDK version and API level

Source: Internet
Author: User

Determine the app's system API level, set minsdkversion and targetsdkversionin Mainfest, version control of the app, set in Mainfest Versioncode and versionname.

Supporting Different Platform Versions

tip:   In order to provide the best features and functionality across several Android versions, you should use THE  an Droid support Library in your app, which allows-use several recen T platform APIs on older versions.

to allow your app for advantage of these changes and ensure that your app fits the style of each user ' s device, yo u should set the targetSdkVersion value to match the latest Android version available.

Reference: What API level should I target?

Tips:

    • Set android:minsdkversion to the minimum API level.

    • Set Android:targetsdkversion to the highest API level, tested your app on.

    • Do not use Android:maxsdkversion.

    • Set your build target to whatever (I recommend the same as your android:targetsdkversion), it does not affect the final AP K.

    • Wrap calls to new APIs in a if where you check the API level.

    • Test your apps!

<uses-sdk>

<mainfest>

<USES-SDK android:minsdkversion="integer"
android:targetsdkversion="integer"
android:maxsdkversion="integer" />

integer-The value of API level

minsdkversion (Required): The minimum API level. If not set, the default API level is "1".

If the application were to is somehow installed on a platform with a lower API level (less than the minsdkversion value), t Hen it would crash at Run-time if it tried to access APIs that ' t exist. And the app would not being installed if this value was higher than that's hte platform version on the target device.

targetsdkversion (Recommended): The API level the application are designed to run and it allows the app to use manifest elements or behavior s defined in the target API level. If not set, the integer value equals to Minsdkversion and only the minimum API level is used.

maxsdkversion (not recommended): If The API level is greater than this value, the app won't be installed. And after a system update, its value must is equal or greater than the system ' s API level Interger.

Check System Version at Runtime
Private voidSetupactionbar() {
//Make sure we ' re running in honeycomb or higher to use ActionBar APIs
if (Build.VERSION.Sdk_int>= Build.Version_codes.Honeycomb) {
ActionBarActionBar=Getactionbar();
ActionBar.setdisplayhomeasupenabled(true);
}
}

Note: You can also use the new version of attributes in XML, and if the version is not supported, the lower version of Android will only ignore a attribute.

API level

A version of Android platform provides the framework API revision, through Framework API app can interact with underlying Android system.

The framework API consists of:

    • A core set of packages and classes

    • A set of XML elements and attributes for declaring a manifest file

    • A set of XML elements and attributes for declaring and accessing resources

    • A set of Intents

    • A set of permissions that applications can request, as well as permission enforcements included in the system

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/49/51/wKioL1QS73qxkGOpAAE4_l7DzTw072.jpg "title=" Qq20140912210417.png "alt=" Wkiol1qs73qxkgopaae4_l7dztw072.jpg "/>

Android applications is generally forward-compatible with new versions of the Android platform.

Filtering the Reference documentation by API level

by default , API level filtering are disabled , so-you can view the full framework APIs, regardless of API level.

to use filtering, select the checkbox to enable filtering, just below the page search box. Then set the Filter by API level control to the same API level as specified by your application. Notice that APIs introduced in a later API level was then grayed out and their content was masked, since they would not being Accessible to your application.

Filtering by API level in the documentation does not provide a view of what's new or introduced in each API level-it si Mply provides a-to-view the entire API associated with a given API level, while excluding API elements introduced in L Ater API levels.

Versioning Your applications--Android APP version control

Android:versioncode  -an integer value that represents the version of the application code, relative to other versions.  applications and publishing services should not display this version value to users.

Android:versionname  -a String Value ( <major>.<minor>.<point> ) that represents the release version of the application code , as it should is shown to users.  publishing Services May Extract

The Android:versionname value for display to users.

eg.

<?XML version="1.0"encoding="Utf-8"?>
<manifest xmlns:android="Http://schemas.android.com/apk/res/android"
Package="Com.example.package.name"
Android:versioncode="2"
Android:versionname="1.1">
<application Android:icon="@drawable/icon" Android:label="@string/app_name">
...
</application>
</manifest>


This article is from "Whispering Autumn Wind" blog, please be sure to keep this source http://xjhznick.blog.51cto.com/3608584/1551769

Android SDK version and API level

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.