Your problem is the tech filter XML file (as you finally correctly found out yourself). The tech filter you were originally using,
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<tech-list>
<tech>android.nfc.tech.Ndef</tech>
<tech>android.nfc.tech.NdefFormatable</tech>
<tech>android.nfc.tech.MifareClassic</tech>
<tech>android.nfc.tech.MifareUltralight</tech>
</tech-list>
</resources>
does not make any sense. <tech>
entries within one <tech-filter>
entry are combined using a logical AND.
So you would need to have a tag that is Ndef
and NdefFormatable
and MifareClassic
and MifareUltralight
. This is impossible for two reasons:
Ndef
andNdefFormatable
are mutually exclusive. A tag can either already contain NDEF data/an empty NDEF message (->Ndef
) or it may be ready to be formatted with an NDEF message (->NdefFormatable
).MifareClassic
andMifareUltralight
are mutually exclusive. A tag can either be a MIFARE Classic tag or a MIFARE Ultralight tag, but not both at the same time.
So, for instance, a proper tech filter that triggers upon tags that contain an NDEF message and are either MIFARE Classic or MIFARE Ultralight would look like this:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<tech-list>
<tech>android.nfc.tech.Ndef</tech>
<tech>android.nfc.tech.MifareClassic</tech>
</tech-list>
<tech-list>
<tech>android.nfc.tech.Ndef</tech>
<tech>android.nfc.tech.MifareUltralight</tech>
</tech-list>
</resources>
All <tech-list>
entries are combined with logical OR then: (Ndef
and MifareClassic
) or Ndef
and MifareUltralight
).
In your case, you seem to be less interested in NDEF but more in getting anything from a MIFARE card. Assuming that by MIFARE you mean a MIFARE Classic card (since you were talking about 1996 ;-) ), your tech filter should look like this:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<tech-list>
<tech>android.nfc.tech.MifareClassic</tech>
</tech-list>
</resources>
But note that this only works on devices with NXP chipset (MIFARE Classic is proprietary NXP technology. While NXP licenses the card-side to other manufacturers, they do not license the reader-side. Consequently, only1 NXP's reader products read MIFARE Classic.). On devices with Broadcom chipset, MIFARE Classic cards2 are not detected as MIFARE Classic. But since MIFARE Classic uses the standard ISO 14443-3 Type A anti-collision and activation sequence, these devices usually3 detect such cards as NfcA
:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<tech-list>
<tech>android.nfc.tech.NfcA</tech>
</tech-list>
</resources>
Note that using a second entry with MifareClassic
tag technology would be redundant as every device that detects MIFARE Classic will detect it as both, MifareClassic
and NfcA
.
1) There are exceptions to that rule as some manufacturers do not agree with NXP's position (or simply ignore it?) that implementing MIFARE Classic support on the reader-side infringes their rights.
2) And only MIFARE Classic. This does not apply to standards conformant MIFARE products like Ultralight, DESFire, NTAG, etc.
3) Some Samsung devices with Broadcom NFC chipset, like the S4, are exceptions to that rule. On these devices Samsung decided to ban MIFARE Classic completely and instead display a "tag not supported" error. As they claim, to improve user experience as user's would otherwise not understand why they can't write data to those tags. Or as I interpret it, to make your users hate you as an app developer as you can't make your app work on their phones with their tags. See the negative reviews on the ReTag app or on my own app.