How to read serial number of the nfc tag?
tony68hcm opened this issue · 2 comments
tony68hcm commented
How to read serial number of the nfc tag?
romellfudi commented
Just read it from Intent variable paramIntent
:
public override fun onNewIntent(paramIntent: Intent) {
...
}
contactBoostTag commented
Hi @tony68hcm, @romellfudi, use the following lines:
// get their id
val tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG) as Tag;
tag_id = tag.getId().toString();
// Finally
val regex = Regex("(.{2})")
val serial_id = regex.replace(ByteArrayToHexString(tag_id), "$1:").dropLast(1)