Fingerprinting of NFC tags is not quite easy. Most tags don't just tell you "I am XY". Moreover, for certain tag technologies there exist many different tags from several different manufacturers. E.g. NFC Forum Type 2 tags are made by NXP, Infineon, Kovio and others.
Finding out if a tag is MIFARE Classic is rather simple on devices with NXP's NFC chipset. On those devices you will see android.nfc.tech.MifareClassic
listed in the tech-list (result of Tag.getTechList()
method). For other NfcA
tags, you could start by doing the following:
If the tag has a 7-byte UID (get it via Tag.getId()
), the first byte indicates the tag manufacturer's ISO 7816-6 registered chip manufacturer code. E.g. 0x04
for NXP, 0x05
for Infineon, etc.
Once you know the chip manufacturer, you could try to send manufacturer-specific commands to the tag (e.g. for NXP tags you could send a GET_VERSION command to check if the tag is an NTAG/MF Ultralight EV1 tag or an authentication command to check if it is Ultralight C) . Some manufacturers also code further chip information into the UID.
You can scan the tags memory to find the memory size and decide upon that value what chip type it is.