I'm very new in NFC for Android. I need very much code example or good tutorial for Java for how get Mifare Ultralight 16 digits UID reading with Nexus 5
I only know how to get 7 digits UID for MifareClassic from here Reading the tag UID of Mifare classic card, but there is no examples for Mifare Ultralight.
This is another example to get UID for Mifare Classic. What do I need to change to make it read for Mifare Ultralight? And I don't understand what performs in ByteArrayToHexString()
byte[] nfcUID = null;
if (intent != null && (nfcUID = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID)) != null) {
uid = ByteArrayToHexString(nfcUID);
private String ByteArrayToHexString(byte[] inarray) { // converts byte arrays to string
int i, j, in;
String[] hex = {
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"
};
String out = "";
for (j = 0; j < inarray.length; ++j) {
in = inarray[j] & 0xff;
i = (in >> 4) & 0x0f;
out += hex[i];
i = in & 0x0f;
out += hex[i];
}
return out;
}
Thank you very much!