如何给条件,Android应用程序只在支持NFC的设备上运行? [英] How to give condition to Android application to run only on NFC enabled device?

查看:165
本文介绍了如何给条件,Android应用程序只在支持NFC的设备上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一种阅读NFC标签细节的应用程序。在该应用程序我想给只有在NFC可用设备运行状态。

I developing a application which read the NFC Tag details.. In that application i want to give the condition to run only in NFC available devices..

先谢谢了...

推荐答案

如果您包括这在你的清单您的应用程序只能在有NFC设备上运行:

If you include this in your manifest your app will only be able to run on devices that have NFC:

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

NfcAdapter.getDefaultAdapter(本)也可以返回具有NFC设备,但NFC功能上是由于某些原因在这种情况下,无法使用。

NfcAdapter.getDefaultAdapter(this) can also return null on a device which has NFC, but the NFC functionality is unavailable for some reason in that case.

这篇关于如何给条件,Android应用程序只在支持NFC的设备上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆