android - Different ID readings for NfcA type mifare card -


i've developed android application read mifare cards nfc reader. there no problem it. application works fine. reads , displays id value of mifare card

i have card reader device attached pc (keyboard emulated)

but card reader , app displaying different ids card reader says : 0992194657 app says : 61b0233b

is there conversion or something?

you should convert bytes arrays hex string follows.

  public static string bytestohex(byte[] bytes) {     char[] hexchars = new char[bytes.length * 2];     (int j = 0; j < bytes.length; j++) {         int v = bytes[j] & 0xff;         hexchars[j * 2] = hexarray[v >>> 4];         hexchars[j * 2 + 1] = hexarray[v & 0x0f];     }     return new string(hexchars); } 

then call

tag mtag = intent.getparcelableextra(nfcadapter.extra_tag);; bytestohex(mtag.getid()) 

kolay gelsin:)


Comments