Search code examples
androidtagsnfcmifarendef

Weird Android device behaviour in reading NFC tech-list


I am trying to read an NFC tag from 2 devices (Nexus 5 and Samsung S5).

I am reading the tag through the foreground dispatch and using ACTION_TECH_DISCOVERED intent. On the Samsung S5, the tech-list lists NfcA, MifareClassic, and Ndef, but on the Nexus 5, it lists only NfcA.

I know that the Nexus 5 doesn't support NXP's MIFARE Classic tags. THus, I understand why it doesn't list MifareClassic. But why does it also not show Ndef in the tech-list?

When I try to read the tag using ACTION_NDEF_DISCOVERED intent, the Samsung S5 is reading it fine, while the Nexus 5 doesn't even detect it.


Solution

  • That's not weird but rather expected behaviour:

    As you found out yourself, the Nexus 5 does not support MIFARE Classic while the Samsung S5 does. The problem with MIFARE Classic is that it uses the well-defined anti-collision mechanism from ISO/IEC 14443-3 and can therefore be detected on all Android NFC devices. On top of that standardized anti-collision, MIFARE Classic uses a proprietary protocol (that slightly differs in its framing and uses a proprietary encryption algorithm). As NXP does not provide licenes for the reader-side of that protocol, only NXP chipsets implement it. As a consequence, only devices with NXP chipsets (like the Samsung S5, which contains a PN547 NFC controller) can access data on MIFARE Classic cards. Other devices (e.g. those with Broadcom NFC chipsets like the Nexus 5 or with Samsung NFC chipsets like the S5 mini) do not support the MIFARE Classic protocol and therefore cannot access the data stored on those chips.

    As a consequence, the MifareClassic tag technology is not shown on those devices, as the platform does not supprt sending MIFARE Classic commands (that's what you could do with the MifareClassic technology object). Moreover, being unable toi send memory access commands, also means that the data stored on the tag cannot be accessed. That's why no Ndef technology is shown: NDEF is the data abstraction layer on top of NFC tags, hence, no access to data means that there is also no means to access that same data through the NDEF abstraction layer. Hence, it would not make sense to provide an Ndef technology object as you could not use it anyways to access the data.