简体   繁体   English

在 android 设备上检测 NFC

[英]Detecting NFC on android devices

Well, my purpose is to detect if the Android device supports NFC and if not I will use some other technology.好吧,我的目的是检测 Android 设备是否支持 NFC,如果不支持,我将使用其他技术。 I have set my minimum API level to 8 as I want my app to function even on these devices without NFC.我已将我的最低 API 级别设置为 8,因为我希望我的应用程序为 function,即使在这些没有 NFC 的设备上也是如此。

Is there a method like isNFCSupported()?有没有类似 isNFCSupported() 的方法? any ideas?有任何想法吗?

thanks yosoh.谢谢yosoh。

Step #1: Put this in your manifest:第 1 步:将其放入清单中:

<uses-feature android:name="android.hardware.nfc" android:required="false" />

Step #2: Call hasSystemFeature(PackageManager.FEATURE_NFC) on PackageManager to see if NFC is available on the current device第 2 步:在 PackageManager 上调用hasSystemFeature(PackageManager.FEATURE_NFC) PackageManager查看当前设备上是否有 NFC

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM