skip to Main Content

I’m new to NFC and I follow the documentation and able to print out some data log from the NFC reader.

void _startNFCReading() async {
    try {
      bool isAvailable = await NfcManager.instance.isAvailable();
      if (isAvailable) {
        NfcManager.instance.startSession(
          onDiscovered: (NfcTag tag) async {
            debugPrint('NFC Tag Detected: ${tag.data}');
          },
        );
      } else {
        debugPrint('NFC not available.');
      }
    } catch (e) {
      debugPrint('Error reading NFC: $e');
    }
  }
}

I use a bank card for testing, I swipe my bank card at the top of NFC reader and my code print out the following:

NFC Tag Detected: {isodep: {identifier: [8, 204, 3, 91], hiLayerResponse: null, historicalBytes: [], isExtendedLengthApduSupported: true, maxTransceiveLength: 65279, timeout: 1500}, nfca: {identifier: [8, 204, 3, 91], atqa: [4, 0], maxTransceiveLength: 253, sak: 32, timeout: 618}}

It doesn’t mean anything to me the above log data.
I use my gym NFC card and swipe above my NFC reader and here’s the log I got:

I/flutter ( 7450): NFC Tag Detected: {nfca: {identifier: [65, 213, 146, 96], atqa: [4, 0], maxTransceiveLength: 253, sak: 8, timeout: 618}, mifareclassic: {identifier: [65, 213, 146, 96], blockCount: 64, maxTransceiveLength: 253, sectorCount: 16, size: 1024, timeout: 618, type: 0}, ndefformatable: {identifier: [65, 213, 146, 96]}}

Could someone please advice on how to read the real data if there’s a way to do it.
From the above log data I think there must be a way to read from a chips memory by using the log data above.

Any help will be much appreciated.

2

Answers


  1. Chosen as BEST ANSWER

    After my research, it seem there's no implementation is available for Flutter at the moment. However, Kotlin can use a Java library as a solution to read credit card information in Android. https://github.com/devnied/EMV-NFC-Paycard-Enrollment#emv-nfc-paycard-enrollment----

    I'm going to use Kotlin to build the App for my ftpos machine in Android.


  2. This is not an answer to your question but more a "hint" about your next steps.

    Working (reading from and/or writing to) with NFC tags depend on the specific protocol your NFC tag is supporting, so there is no "all in one" way to read data from a NFC tag.

    As a first step for a beginner, download the "TagInfo" app by NXP in your app store to find out the NFC type of your tag.

    Then try to find a tutorial for this tag type. E.g. having a bank card it could be usefull to search for "flutter" and "emv" as most bank cards follow the "EMV" standard.

    The logs are just some data the NFC reader collected for a "first contact", but contain e.g. data about the protocol the cards are running (see behind "NFC Tag Detected": the bank card is using the IsoDep class, the Gym one is communicating using the NfcA class).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search