官术网_书友最值得收藏!

Defining minimal requirements

Defining minimal requirements is a very important step since only users with minimal requirements will be able to run our application properly.

NFC was introduced in Android Version 2.3, API level 9, although some very important features, such as being able to get an instance of the NFC Adapter, were only introduced in API level 10. This is the minimum API level we can work with. Users with previous versions of Android will not be able to use our NFC applications unless a fallback alternative is added.

How to do it…

We are going to define the minimum required version of Android to enable our application to use NFC features, as follows:

  1. Open the previously created NfcBookCh1Example1 project.
  2. Set the minimum SDK version to 10 with the following code:
    <uses-sdk android:minSdkVersion="10" />

How it works…

When we add the previous line to the manifest file, Eclipse will automatically scan our code and warn us of incompatible pieces of code. This is also used in the market to filter searches for apps that our devices are able to run. NFC-related features are consistently being added and improved in the latest Android releases; so, depending on your application specifications, you may need to target a higher version.

主站蜘蛛池模板: 大关县| 丘北县| 东辽县| 云梦县| 吉木萨尔县| 太原市| 耒阳市| 乐亭县| 商河县| 昌黎县| 洞口县| 甘谷县| 海兴县| 依兰县| 东宁县| 庆安县| 宁都县| 东乡县| 连云港市| 石楼县| 大庆市| 广西| 四川省| 获嘉县| 安徽省| 满洲里市| 平陆县| 环江| 丹寨县| 禹州市| 肇东市| 体育| 丰镇市| 陈巴尔虎旗| 大埔县| 江达县| 花莲县| 平山县| 南华县| 浦北县| 吉林省|