我想知道以下问题的答案:
答案 0 :(得分:0)
标签类型识别示例:
Intent intent = getIntent();
if (intent.hasExtra(NfcAdapter.EXTRA_TAG)) {
Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG));
if(NfcA.get(tag) != null)
Toast.makeText(this, "Type A tag found!", Toast.LENGTH_LONG).show();
else if(NfcB.get(tag) != null)
Toast.makeText(this, "Type B tag found!", Toast.LENGTH_LONG).show();
else if(NfcF.get(tag) != null)
Toast.makeText(this, "FeliCa tag found!", Toast.LENGTH_LONG).show();
else if(NfcV.get(tag) != null)
Toast.makeText(this, "ISO15693 tag found!", Toast.LENGTH_LONG).show();
else if(Ndef.get(tag) != null)
Toast.makeText(this, "Android Beam message received!", Toast.LENGTH_LONG).show();
else
Toast.makeText(this, "Unknown tag type!", Toast.LENGTH_LONG).show(); // hypothetical...
}
Android中没有定义与外部阅读器通信的API。您可以考虑使用LLCP和SNEP在阅读器中实现点对点通信(请参阅NFC Forum了解规范)。