【发布时间】:2011-04-14 05:52:16
【问题描述】:
我正在使用 NFC Android 编程,我想读取 Mifare Classic 卡。有人知道如何从这样的卡上读取扇区吗?
Authentication 方法返回 true 表示认证完成。身份验证后,扇区应该为任何 IO 操作做好准备,但是每当我使用 readBlock() 方法或 transceive() 方法时,我都会遇到 IOException("transceive failed") 异常。我找不到任何使用 Mifare Classic 的示例,所以我想知道是否可以使用此 API 阅读 Mifare Classic。
我的代码是这样的boolean success = m1tag.authenticateSectorWithKeyB(0,MifareClassic。KEY_DEFAULT)
int index = m1tag.sectorToBlock(0)
byte[] content = m1tag.readBlock(index)
成功是真的,但是当我从卡中读取内容时,抛出 IOException("transceive failed")
【问题讨论】: