We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sector authentication succeeds, but reading sector data fails
NFCTag tag = await FlutterNfcKit.poll(); setState(() { _tag = tag; }); await FlutterNfcKit.setIosAlertMessage("Working on it..."); _mifareResult = null; if (tag.type == NFCTagType.mifare_classic) { final defaultKey = Uint8List.fromList([0x00, 0x00, 0x00, 0x00, 0x00, 0x00]); bool success = await FlutterNfcKit.authenticateSector(0, keyA: defaultKey); if (success) { print('authenticateSector success'); var data = await FlutterNfcKit.readSector(0); // read one sector, or var data2 = await FlutterNfcKit.readBlock(0); // read one block print(data); print(data2); } else { print('authenticateSector failed'); } }
I/flutter (16990): authenticateSector success E/im.nfc.flutter_nfc_kit.FlutterNfcKitPlugin(16990): Read sector error E/im.nfc.flutter_nfc_kit.FlutterNfcKitPlugin(16990): java.io.IOException: Transceive failed E/im.nfc.flutter_nfc_kit.FlutterNfcKitPlugin(16990): at android.nfc.TransceiveResult.getResponseOrThrow(TransceiveResult.java:52) E/im.nfc.flutter_nfc_kit.FlutterNfcKitPlugin(16990): at android.nfc.tech.BasicTagTechnology.transceive(BasicTagTechnology.java:154) E/im.nfc.flutter_nfc_kit.FlutterNfcKitPlugin(16990): at android.nfc.tech.MifareClassic.readBlock(MifareClassic.java:431) E/im.nfc.flutter_nfc_kit.FlutterNfcKitPlugin(16990): at im.nfc.flutter_nfc_kit.MifareUtils.readSector(MifareUtils.kt:126)
I found that if you execute the authenticateSector twice then the reading is normal
NFCTag tag = await FlutterNfcKit.poll(); setState(() { _tag = tag; }); await FlutterNfcKit.setIosAlertMessage("Working on it..."); _mifareResult = null; if (tag.type == NFCTagType.mifare_classic) { final defaultKey = Uint8List.fromList([0x00, 0x00, 0x00, 0x00, 0x00, 0x00]); bool success = await FlutterNfcKit.authenticateSector(0, keyA: defaultKey); if (success) { print('authenticateSector success'); await FlutterNfcKit.authenticateSector(0, keyA: defaultKey); var data = await FlutterNfcKit.readSector(0); // read one sector, or var data2 = await FlutterNfcKit.readBlock(0); // read one block print(data); print(data2); } else { print('authenticateSector failed'); } }
I/flutter (16990): authenticateSector success I/flutter (16990): [44, 122, 185, 207, 32, 8, 4, 0, 4, 253, 133, 164, 78, 121, 80, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 7, 128, 105, 255, 255, 255, 255, 255, 255] I/flutter (16990): [44, 122, 185, 207, 32, 8, 4, 0, 4, 253, 133, 164, 78, 121, 80, 144] I/flutter (16990): Instance of 'NFCTag'2222222
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Sector authentication succeeds, but reading sector data fails
code
log
I found that if you execute the authenticateSector twice then the reading is normal
code
log
The text was updated successfully, but these errors were encountered: