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

Indicating that your app uses NFC

This step isn't required, but it is always good practice to specify the features used in our app manifest file—if it is indeed a required feature for our application to work correctly. Google Play Store uses this information to filter the apps visible to users based on their device's specifications. Users with incompatible devices will be able to install the application if we don't specify this, and we don't want that. We don't want users to get frustrated with a non-working application and give us negative feedback.

How to do it…

We are going to continue adding functionality to the previously created project by declaring the features required by our application in the manifest as follows:

  1. Open the NfcBookCh1Example1 project created in the previous recipe.
  2. Open the AndroidManifest.xml file located in the project root and add the following code just before the application node. Since NFC is a required feature in our application, we should also set the required attribute to true, as shown in the following line of code:
    <uses-feature android:name="android.hardware.nfc"  android:required="true" />

How it works…

The Android market uses this information in the manifest to filter the apps visible to the users. This way, if your device doesn't support a required feature of an app, there's no need for that app to appear listed; it will still be listed on the website but we cannot install it since it's incompatible. This application node is not required, but it's a good idea to place it. Otherwise, the user will be disappointed with the app—it will probably just crash or show an an error occurred! message. Users don't like that, and this results in a bad rating.

An alternative is to have multiple approaches for the same result. For example, if the user's device isn't NFC enabled, use a QR code instead (when applicable).

主站蜘蛛池模板: 清远市| 和平区| 肥西县| 象山县| 正阳县| 张家界市| 永靖县| 涿鹿县| 银川市| 清苑县| 兰坪| 彰化市| 牟定县| 瑞昌市| 房产| 饶阳县| 曲水县| 永春县| 呼和浩特市| 东台市| 高邑县| 隆昌县| 花垣县| 娱乐| 渑池县| 吉水县| 德惠市| 习水县| 手机| 新邵县| 同心县| 新乐市| 仪征市| 丹阳市| 蒙城县| 兴宁市| 黄冈市| 曲沃县| 湘阴县| 四会市| 仁化县|