如何阅读NFC标签? [英] How to Read NFC Tag?
本文介绍了如何阅读NFC标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好我想从NFC标签读取。但我得到一个例外。
Hi I am trying to read from NFC Tag. But I am getting an exception.
我已经把这个条件来检测标签?
I have put this condition to detect the tag?
if(NfcAdapter.ACTION_TAG_DISCOVERED != null)
无论这个条件是正确的?
Whether this condition is correct?
推荐答案
要回答你的问题有关code -
To answer you question about the code -
这将永远是真实的 - NfcAdapter.ACTION_TAG_DISCOVERED
是一个恒定值 - 你需要使用:
That will always be true - NfcAdapter.ACTION_TAG_DISCOVERED
is a constant value - you need to use:
getIntent().getAction().equals(NfcAdapter.ACTION_TAG_DISCOVERED)
要进行比较。
不过,这可能无关,与你的例外 -
But, that probably has nothing to do with your exception -
- 你包括NFC允许在你的Android清单?
- 你确定你的手机支持NFC,只有两三个就在这个时候支持。
- 我们就需要从日志堆栈跟踪知道是什么引起的异常
这篇关于如何阅读NFC标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文