在Android中发现标签时如何识别mifare classic和mifare ultralight

问题描述 投票:0回答:3

我正在android中研究nfc,我想知道发现的标签是Mifare Classic还是Mifare Ultralight或任何其他。请告诉我该怎么做?

java android nfc mifare
3个回答
1
投票

尝试

String[] techs = tag.getTechList();
for (String t : techs) {
  if ("com.android.nfc.tech.MifareClassic".equals(t)) {
    ... // it's MIFARE Classic
  }
  else if ("com.android.nfc.tech.MifareUltralight".equals(t)) {
    ... // it's MIFARE Ultralight
  }
}

0
投票

This SO 帖子包含一些带有

片段的代码
String type = ndefTag.getType();         // tag type

这看起来像你需要的


0
投票

如果有人仍然想知道,

public synchronized void onTagDiscovered(Tag tag) {
  tag.hasTech(8) // Classic    
  tag.hasTech(9) // Ultralight
© www.soinside.com 2019 - 2024. All rights reserved.