capawesome-team / capacitor-plugins

⚡️ Community plugins for Capacitor. Supports Android, iOS and the Web.
https://capawesome.io/plugins/
172 stars 25 forks source link

bug: Module is not showing complete data #141

Closed pfargowiz closed 3 months ago

pfargowiz commented 3 months ago

Plugin(s)

Version

5.0.2

Platform(s)

Current behavior

I used capawesome-team/capacitor-nfc plugin in my application. It performed well overall, but during my comparison with other NFC applications, I noticed some discrepancies. I scanned an NFC tag using your module. Then I scanned the same NFC tag using a separate 3rd party application from the App Store. Surprisingly, the data fields and content were significantly different.

You can check out the difference between the data provided by your module and a 3rd party Application. So are there any module limitations or am I missing something during implementation?

Expected behavior

The module must be able to read all data from the NFC Tags.

Reproduction

https://github.com/capawesome-team/capacitor-nfc-demo

Steps to reproduce

Framework - Ionic React I have used the same code as given in the demo.

Other information

Data from capacitor-nfc module Screenshot_2

Data from a 3rd party NFC Reader Application 3

Capacitor doctor

Capacitor Doctor

Latest Dependencies:

@capacitor/cli: 5.7.0 @capacitor/core: 5.7.0 @capacitor/android: 5.7.0 @capacitor/ios: 5.7.0

Installed Dependencies:

@capacitor/core: 5.4.2 @capacitor/android: 5.4.2 @capacitor/ios: 5.4.2 @capacitor/cli: 5.4.2

Before submitting

robingenz commented 3 months ago

First of all, the aim of our demo app is not to display all possible NFC tag information, but simply to illustrate the use of the plugin.

So are there any module limitations or am I missing something during implementation?

It is possible that certain information is not yet queried by the plugin. This is simply because Android/iOS offer a wide range of interfaces. If you are missing certain information, please create a feature request and we will take a look.

For example, dsfId can already be retrieved under Android, see NfcTag.

Since this is not a bug, I am closing this issue.

pfargowiz commented 3 months ago

Thanks for the Prompt Reply! I am using the below code to read the NFC data but it only gives me 2 fields - id and techTypes, whereas when I scan the same card using a separate app (NFC Tools), I get additional information like DSFId, Tag Type, and Serial Number (Please check screenshots in the original question) For my use case, I need to display complete information. I need to know if I am missing something!

Code

export const read = async (stopNfcScan?: any) => {

  return new Promise((resolve: any) => {

    Nfc.addListener("nfcTagScanned", async (event) => {

      await Nfc.stopScanSession();

      resolve(event.nfcTag);

    });

    Nfc.startScanSession();

  });

};

Result

{"id": [4, -127, -123, -110, 102, 118, -128], "techTypes": ["ISO_DEP", "NFC_A", "NDEF_FORMATABLE"]}

robingenz commented 3 months ago

As i said, certain information is not yet queried by the plugin. Please create a feature request for the information you want to retrieve and we will take a look.