ACR122 - Android / How to extract the UID

前端 未结 1 588
别那么骄傲
别那么骄傲 2020-12-11 10:44

I try to integrate an ACR122 to my android app. I\'m using the ANDROID Library (http://www.acs.com.hk/en/products/3/acr122u-usb-nfc-reader/) available from ACS.

Eve

相关标签:
1条回答
  • 2020-12-11 11:16

    In case of Mifare card you need to send this APDU byte array to the card: (byte) 0xFF, (byte) 0xCA, (byte) 0x00, (byte) 0x00, (byte) 0x00 . I'm not sure about ACR122 API but probably you need to wrap this APDU into specific API method like transmit()

    UPDATE

    Sample code:

     byte[] command = { (byte) 0xFF, (byte) 0xCA, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
     byte[] response = new byte[300];
     int responseLength;
     responseLength = reader.transmit(slotNum, command, command.length, response,response.length);
     System.out.println(new String(response));
    

    Reader is com.acs.smartcard.Reader object and slotNum is a the slot number. I’m not sure how to find it because I don’t have ACR to test. But if you told that you was able to establish basic communication with reader probably you know slotNum.

    0 讨论(0)
提交回复
热议问题