以编程方式检查设备是否具有NFC读取器 [英] Check programmatically if device has NFC reader

查看:116
本文介绍了以编程方式检查设备是否具有NFC读取器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在运行时检查设备是否具有NFC读取器?我的应用程序使用NFC执行任务,但是如果没有阅读器,则可以使用按钮执行相同的任务.

Is there a way to check at run time whether a device has an NFC reader? My app uses NFC to perform a task, but if no reader is present, it can perform the same task by using a button.

推荐答案

希望对您有用

NfcManager manager = (NfcManager) context.getSystemService(Context.NFC_SERVICE);
NfcAdapter adapter = manager.getDefaultAdapter();
if (adapter != null && adapter.isEnabled()) {

    //Yes NFC available 
}else{

   //Your device doesn't support NFC
}

这篇关于以编程方式检查设备是否具有NFC读取器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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