- Near Field Communication with Android Cookbook
- Vitor Subtil
- 312字
- 2021-07-16 11:37:22
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:
- Open the
NfcBookCh1Example1
project created in the previous recipe. - 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 totrue
, 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).
- 計(jì)算機(jī)組成原理與接口技術(shù):基于MIPS架構(gòu)實(shí)驗(yàn)教程(第2版)
- 有趣的二進(jìn)制:軟件安全與逆向分析
- Greenplum:從大數(shù)據(jù)戰(zhàn)略到實(shí)現(xiàn)
- 從0到1:數(shù)據(jù)分析師養(yǎng)成寶典
- PySpark大數(shù)據(jù)分析與應(yīng)用
- 數(shù)據(jù)庫(kù)應(yīng)用基礎(chǔ)教程(Visual FoxPro 9.0)
- Mastering Machine Learning with R(Second Edition)
- Python醫(yī)學(xué)數(shù)據(jù)分析入門(mén)
- 聯(lián)動(dòng)Oracle:設(shè)計(jì)思想、架構(gòu)實(shí)現(xiàn)與AWR報(bào)告
- 數(shù)據(jù)挖掘競(jìng)賽實(shí)戰(zhàn):方法與案例
- Hands-On Deep Learning for Games
- 云工作時(shí)代:科技進(jìn)化必將帶來(lái)的新工作方式
- 大數(shù)據(jù)測(cè)試技術(shù):數(shù)據(jù)采集、分析與測(cè)試實(shí)踐(在線實(shí)驗(yàn)+在線自測(cè))
- 大數(shù)據(jù)隱私保護(hù)技術(shù)與治理機(jī)制研究
- 精通Neo4j