Question

I'm not asking about Ndef in general - it is obvious that we need some format for data interchange.

I'm working on an application that must read both - non-Ndef (Mifare Classic in particular) and Ndef NFC chips. I've separated routines for reading both and I also managed the detection part:

Tag tag = intent.getParcelableExtra( NfcAdapter.EXTRA_TAG );
String[] techList = tag.getTechList();

for ( String tech : techList ) {
    if ( MifareClassic.class.getName().equals( tech ) ) {
        String uid = byte2HexString( tag.getId() );
        // TODO
    } else if ( Ndef.class.getName().equals( tech ) ) {
        return this.readNdef( intent );
    }
}

But what I'm not sure about is the abstraction part - should I actually try to encode the data from non-Ndef (MC) chip to Ndef (if that's even possible), or should I just completely separate these abstraction layers? Is there any advantage of encoding data to Ndef?

Was it helpful?

Solution

The advantage of using NDEF formatted data is that this is more portable across different systems. NDEF compliant data should work not only on Android, but also on Windows8 or Blackberry devices (with NFC).

The Mifare Classic chip is not part of the NFC specs and therefore works only on phones with the NXP protocol software, but on those phones you can easily store data in NDEF format into a Mifare Classic chip.

The destinction to make is more whether a particular device supports the Mifare Classic chip, than whether you want to use NDEF or not.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top