okadan / flutter-nfc-manager

A Flutter plugin for accessing the NFC features on Android and iOS.
https://pub.dev/packages/nfc_manager
MIT License
210 stars 134 forks source link

NDEF Read bug #165

Open Pranet-Hiranandani opened 1 year ago

Pranet-Hiranandani commented 1 year ago

Even with using the following code provided on the official documentation for the plugin:

Ndef? ndef = Ndef.from(tag);

if (ndef == null) {
    print('Tag is not compatible with NDEF');
    return;
}
NdefMessage message = await ndef.read();

I am getting a null reading on the ndef.from(tag) function, despite the same code working for me previously and the tag being ndef compatible.

Here's the data outputted from the "tag.data" function: {nfca: {identifier: [98, 173, 223, 85], atqa: [4, 0], maxTransceiveLength: 253, sak: 8, timeout: 618}, mifareclassic: {identifier: [98, 173, 223, 85], blockCount: 64, maxTransceiveLength: 253, sectorCount: 16, size: 1024, timeout: 618, type: 0}, ndefformatable: {identifier: [98, 173, 223, 85]}}

In this case the ndefformatable value being non-null clearly shows that even the package reads the tag as ndef compatible. I am unable to build the rest of my app due to this issue, building part of it due to the plugin working perfectly with the same card before.

Am on the latest stable version of both the plugin and flutter.

Running the latest stable version of Android 14 on a Pixel 7a

Please help me with fixing this issue so I can continue building my app.

Pranet-Hiranandani commented 1 year ago

The issue is randomly occuring. Not sure of the cause of the issue.

Adithyan2295 commented 12 months ago

The issue is randomly occuring. Not sure of the cause of the issue.

https://stackoverflow.com/questions/25512204/not-able-to-format-nfc-card-using-ndefformatable

according to this stackoverflow solution a newcard supports NdefFormatable .. so for a new card i dont think Ndef? ndef = Ndef.from(tag); works ..I think we have to use final ndefFormatable = NdefFormatable.from(tag); but this code is also not working and I am also stuck in this same issue

jayjayesh commented 9 months ago

You could try these all, check which one is work. in my case, (NfcA) (IsoDep) works.

As shown in ReadMe file

Screenshot 2024-02-17 at 6 33 10 PM