chariotsolutions / phonegap-nfc

PhoneGap NFC Plugin
MIT License
706 stars 557 forks source link

addNdefListener not calling callback on first attempt #218

Closed homer-jay closed 6 years ago

homer-jay commented 8 years ago

FIX for issue 217: addNdefListener not calling callback on first attempt

I don't know why the Intent contains the ACTION_NDEF_DISCOVERED when reading non-MIME NDEF records the first time. After the first read, the action contains the ACTION_TECH_DISCOVERED as expected.

Even if this behavior were not the plugin's fault, it does make sense to fire the "ndef" event when reading MIME records in adition to the "ndef-mime" event, because if we have registered a callback with addNdefListener, then we want to be called back on every subtype of NDEF record.

Segfaultd commented 7 years ago

Can this pull request be merged please, this is really an annoying bug.. Thx!

don commented 6 years ago

This fixes the symptom but causes 2 events to be fired causing problems when an app uses both addNdefListener and addMimeTypeListener. I think I've tracked this problem down. See https://github.com/chariotsolutions/phonegap-nfc/issues/217#issuecomment-394000926 for more details.

don commented 6 years ago

Thanks for the pull request. I'm closing this because the problem is fixed by #324