我需要通过NFC与带有黄玉标签的Android移动设备Nexus S通信。我已经完成了从卡中读取数据的java程序,但这使用了javax.smartcardio java类,这在Android上不可用。我如何导入这个类以使其在Android项目中可用?
非常感谢。
发布于 2011-06-26 14:10:18
为了与Android上的标签直接通信,你必须从一个新的NFC意图(NDEF_DISCOVERED,TECH_DISCOVERED,TAG_DISCOVERED)获取对检测到的标签的引用。设置一个接收这些事件的活动,然后提取标签对象;
Tag tag = getIntent().getParcelableExtra(NfcAdapter.EXTRA_TAG);
MifareClassic mifareClassicTag = MifareClassic .get(tag);
mifareClassicTag.connect();
// The transceive command sends command directly to the tag. Internally it wraps the given command in a direct transmit command and sends it to the NFC chip which forwards it to the tag
mifareClassicTag.transceive(...);有关android http://developer.android.com/guide/topics/nfc/index.html上NFC的更多信息,请参阅开发人员文档。
https://stackoverflow.com/questions/6451070
复制相似问题