Note5读Mifare经典卡UID

时间:2019-09-10 07:06:19

标签: java android nfc mifare

我正在开发一个仅读取MIFARE Classic卡的UID的应用程序。但是,每次在Galaxy Note 5上扫描卡时,都会收到一条吐司消息“不支持NFC标签类型”,并且不会显示UID。

我知道这是因为我手机的NFC芯片与Mifare Classic不兼容,但是有什么方法可以修复它吗?

static void showToast() {
    if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(getIntent().getAction())) {
        Tag tag = getIntent().getParcelableExtra(NfcAdapter.EXTRA_TAG);

        Toast.makeText(MainActivity.this, 
                "The UID for this card is:" + bin2hex(tag.getId()), 
                Toast.LENGTH_LONG)
                .show();
    }
}

static String bin2hex(byte[] data) {
    return String.format("%0" + (data.length * 2) + "X", new BigInteger(1, data));
}

谢谢。

1 个答案:

答案 0 :(得分:0)

Galaxy Note 5不支持Mifare Classic。看到这里:https://www.shopnfc.com/en/content/7-nfc-compatibility#samsung
Mifare Classic是NXP的专有产品,因此,无论三星使用NXP的任何设备(Galaxy Note 2 Note 8,Note 9),都支持Mifare classic。
由于需要更改硬件,因此无法在Note 5上进行此操作。