Reading wrong data Mifare Classic

Forum / MIFARE and NFC Reader IC`s / Reading wrong data Mifare Classic

  • 13. February 2020 at 12:45
    I am using in my Android Studio

    implementation ('taplinx-android:nxpnfcandroidlib:1.5@aar'){
    transitive = true
    changing = true
    }


    I am using sample code for Mifare Reading and Writing opeartion.

    I written data successfully in default sector of classic = 6. Also, I got data written successfully!!! message but when i read data from
    the same sector I am getting 000000000000000000000 data. So my question how do i read and write data properly ?

    I am using below code

    int blockTorw = 6;
    int sectorOfBlock;
    try {

    //Call connect first is the Reader is not connected
    if (!mifareClassic.getReader().isConnected()) {
    mifareClassic.getReader().connect();
    }

    sectorOfBlock = mifareClassic.blockToSector(blockTorw);

    if (is_write) {
    /** write data to block **/
    mifareClassic.writeBlock(blockTorw, Consts.DATA.getBytes());
    } else {

    /** read data from block **/
    byte[] default_ff_key = {(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF};
    mifareClassic.authenticateSectorWithKeyA(sectorOfBlock, default_ff_key);
    data = mifareClassic.readBlock(blockTorw);
    String str = Utilities.dumpBytes(data);
    }
    } catch (Exception e) {
    logger.debug("Classic tag error: " + e.getMessage());
    }



    Attached screenshots for more details
    + 0  |  - 0

    Re: Reading wrong data Mifare Classic

    13. February 2020 at 12:45
    Hi Manish,

    In a different post I explained that you have an error in your code.

    The TapLinx team

    + 2  |  - 0

    Re: Reading wrong data Mifare Classic

    3. March 2020 at 13:58
    Yes I got you. Thanks
    + 0  |  - 0
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.