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

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.

主站蜘蛛池模板: 富蕴县| 孟津县| 油尖旺区| 凤翔县| 崇文区| 建瓯市| 浦北县| 乐山市| 花莲市| 额敏县| 民勤县| 南皮县| 杭锦后旗| 宁都县| 望城县| 武宁县| 武宣县| 永川市| 宁远县| 连江县| 横峰县| 文化| 皋兰县| 合山市| 静安区| 新平| 巴里| 玉树县| 德令哈市| 德昌县| 公主岭市| 禄劝| 贺州市| 阿尔山市| 江北区| 康平县| 临沧市| 延吉市| 安塞县| 扎赉特旗| 伊川县|