INTag213215216.enableCounter(true) not working

Forum / MIFARE SDK / INTag213215216.enableCounter(true) not working

  • 16. March 2016 at 8:07

    A N
    I am using Mifare SDK Lite & building an Android application that writes URL to NTAG216 tags.
    I want to enable counter & UID mirror as NXP TagWriter does. But it's not working.
    Below is my code snippet.
    After the tag is encoded, I don't see interaction counter being returned by the URL eg. (
    Can you help?

    //Tag already has some data & writing is password protected
    // After writing the URL, password protect the tag again
    public static boolean writeURITag(String uri, INTag213215216 tag, String password) {
    byte pack[] = {0, 0};
    byte pw[] = password.getBytes();
    try {
    if (!"".equals(password)) {
    tag.authenticatePwd(pw, pack);
    com.nxp.nfclib.ndef.NdefRecord ndefr = createURIRecord(uri);
    com.nxp.nfclib.ndef.NdefMessage ndefm = getNdefMessage(ndefr);
    tag.programPWDPack(pw, pack);
    tag.enablePasswordProtection(false, tag.getFirstUserpage());
    tag.authenticatePwd(pw, pack);

    //uri eg.
    public static com.nxp.nfclib.ndef.NdefRecord createURIRecord(final String uri) {
    byte[] uriField = uri.getBytes(Charset.forName("US-ASCII"));
    byte[] payload = new byte[uriField.length + 1]; //add 1 for the URI Prefix
    payload[0] = 0x04; //prefixes https:// to the URI
    System.arraycopy(uriField, 0, payload, 1, uriField.length); //appends URI to payload
    return new NdefRecord(
    NdefRecord.TNF_WELL_KNOWN, NdefRecord.RTD_URI, new byte[0], payload);

    public static com.nxp.nfclib.ndef.NdefMessage getNdefMessage(com.nxp.nfclib.ndef.NdefRecord record) {
    return new com.nxp.nfclib.ndef.NdefMessage(new com.nxp.nfclib.ndef.NdefRecord[]{record});

    + 0  |  - 0
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.