appidea / react-native-hce

Emulate smart cards inside React-Native application.
MIT License
71 stars 26 forks source link

HCE_STATE_READ event is fired multiple times on tag reading #26

Open buenaondalab opened 1 year ago

buenaondalab commented 1 year ago

I'm trying to emulate a NFCtagType4 with an Android device. I'm able to read the tag but HCE_STATE_READ event is fired 3 times. Is that the desired behaviour? I fixed it locally in respondRead method inside NFCTagType4 class:

if (realLength == slicedResponse.length) {
      this.hceModel.getLastState()
                   .setValue(HceViewModel.HCE_STATE_READ);
    }

Could it be a valid solution to avoid multiple firings?