capawesome-team / capacitor-nfc

⚡️ Capacitor plugin for reading and writing NFC tags.
https://capawesome.io/plugins/nfc/
MIT License
73 stars 14 forks source link

bug: Can't read Mifare DESFire EV3 #16

Closed bols1992 closed 1 year ago

bols1992 commented 1 year ago

Plugin version: 4.0.0-dev.b27cc99.1680895427

Platform(s): Android 11

Current behavior: if i want to read my nfc tag Mifare DESFire EV3 4k i have the Message "E/NfcPlugin: Attempt to get length of null array" in the console

image

when i read the nfc tag with the nfc tools app i get the following output, generally the target is to read the encrypted application but in the first step the uid of the tag would be enough for me but i get the error

image

Normal tags can be read.

Related code:

Nfc.addListener('nfcTagScanned', event => {          
          console.log('nfcTagScanned'+ JSON.stringify(event.nfcTag));
          this.ngZone.run(() => {
            this.scannedTagSubject.next(event.nfcTag);
          });
        });

Capacitor doctor:

 @capacitor/cli: 4.7.3
  @capacitor/core: 4.7.3
  @capacitor/android: 4.7.3
  @capacitor/ios: 4.7.3
robingenz commented 1 year ago

Thank you for reporting this. Can you reproduce this issue with our Capacitor NFC Demo app?

bols1992 commented 1 year ago

Hello,

I had previously tested it with the demo app at the same result. Attached is a short video

https://app.screencast.com/quRRPgh2o2cJe

robingenz commented 1 year ago

Thanks for the video. I tried to reproduce the issue with my Pixel 6a and this MIFARE DESFire EV3 8k tag. However, I was able to read the UID without any problem (see video).

https://user-images.githubusercontent.com/13857929/235338468-6db75470-6e08-4397-a64a-99bf3da42962.mp4

Have you tried formatting the card?

bols1992 commented 1 year ago

Hey, after i format the tag, i can read the tag with the demo app. If I then describe the tag again, I get the error again or, as can be seen in the video, no output.

https://user-images.githubusercontent.com/106117971/235345398-1eef4be4-9396-40ab-b99f-a4e97fc54e86.mp4

robingenz commented 1 year ago

Thank you so much for your help! I was able to reproduce the issue and found the problem. The fix will be released with the next update for Capacitor 5. If you need the fix earlier, just let me know.

robingenz commented 1 year ago

Update: I just released an update for Capacitor 4:

npm i @capawesome-team/capacitor-nfc@0.3.2

Thank you again for your help.