Android NFC: "transceive failed" exception when using transceive ()

I am trying to establish a connection between a Samsung Galaxy S3 and a smart card that supports NfcAand IsoDep(Mifare DESFire EV1). To do this, I turned on forgeground sending and started the task when a tag was detected. The code in the task is as follows:

IsoDep isoDep = IsoDep.get(tag);

byte[] selectCommand = {
        (byte)0x00, // CLA
        (byte)0xA4, // INS
        (byte)0x04, // P1
        (byte)0x00, // P2
        (byte)0x0A, // LC
        (byte)0x01,(byte)0x02,(byte)0x03,(byte)0x04,(byte)0x05,(byte)0x06,(byte)0x07,(byte)0x08,(byte)0x09,(byte)0xFF, // AID
        (byte)0x7F  // LE
};

try {
    isoDep.connect();
    byte[] response = isoDep.transceive(selectCommand);
    String result = bytesToString(response);
    isoDep.close();
    return result;
} catch (Exception e) {
    e.printStackTrace();
}

The transceiver method throws this exception:

java.io.IOException: Transceive failed

All other methods IsoDep(for example, getTimeout()) can be executed without errors. Increasing the timeout does not change the behavior. An applet with an AID in the selection command is present on the map. I also tried using a class NfcA. But then I get the "tag lost" exception.

Can Galaxy S3 Problem?

+4
1

, . Galaxy S3 .

+1

Source: https://habr.com/ru/post/1611795/


All Articles