Книга: Beginning Android

Achieving the Minimum

Achieving the Minimum

Android, like most operating systems, goes through various revisions, versions, and changes. Some of these affect the Android SDK, meaning there are new classes, methods, or parameters you can use that you could not in previous versions of the SDK.

If you want to ensure your application is run only on devices that have a certain version (or higher) of the Android environment, you will want to add a uses-sdk element as a child of the root manifest element in your AndroidManifest.xml file. The uses-sdk element has one attribute, minSdkVersion, indicating which SDK version your application requires:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
 package="com.commonsware.android.search">
 <uses-sdk minSdkVersion="2" />
 ...
</manifest>

At the time of this writing, there are two possible minSdkVersion values:

• 1, indicating the original Android 1.0 SDK

• 2, indicating the Android 1.1 SDK

If you leave the uses-sdk element out entirely, it will behave as though minSdkVersion is set to 1.

If you set uses-sdk, the application will install only on compatible devices. You do not have to specify the latest SDK, but if you choose an older one, it is up to you to ensure your application works on every SDK version you claim is compatible. For example, if you leave off uses-sdk, in effect you are stipulating that your application works on every Android SDK version ever released, and it is up to you to test your application to determine if this is indeed the case.

Оглавление книги


Генерация: 1.227. Запросов К БД/Cache: 3 / 1
поделиться
Вверх Вниз