chariotsolutions / phonegap-nfc

PhoneGap NFC Plugin
MIT License
703 stars 547 forks source link

Writing NFC Tag didn't succeeded every time in Quasar Cordova mobile App #469

Open larasoft-io opened 2 years ago

larasoft-io commented 2 years ago

I am developing a Quasar (Vuejs) Cordova mobile App and a feature that writes NFC tag. But the problem is it sometimes write on NFC tag successfully and sometimes do not.

Following is the function I am trying to use to scan NFC tag:

function onNfc(nfcEvent){

    var message = [
      **ndef.textRecord(444)**
    ];

    nfc.write(
      message,
      success => {
          alert('NFC Tag successfully encoded');
          nfc.removeNdefListener(onNfc)
          nfc.close();
      },
      error => {
        console.log(error);
      },
    );
    nfc.addNdefListener(onNfc, success => {console.log('here')}, error => {alert(error)})
  }

Please check attached screenshot below in which you can see the scanned data. It is the case when this plugin is unable to write 444 successfully.

WhatsApp_Image_2022-04-29_at_4 05 49_PM jpeg