chariotsolutions / phonegap-nfc

PhoneGap NFC Plugin
MIT License
706 stars 557 forks source link

Removing Ndef listener on Android #234

Closed arvedviehweger closed 8 years ago

arvedviehweger commented 8 years ago

Dear Don,

does removing the Ndef listener work in the latest version (0.6.6)?

I tried using the following for removing the listener with version 0.5.1:

nfc.removeNdefListener( onNfcR, function () { alert("Success, the listener has been removed."); }, function (error) { alert("Removing the listener failed"); } );

Apparently this always gives me the fail message. My question is, does removing listeners on Android work at all?

Thank you

don commented 8 years ago

Removing the NDEF listener should work.

I don't recommend removing and re-adding listeners. I think a better approach is to leave the listeners and conditionally ignore the data coming into the listener when you don't care about it.

If you're still seeing a problem removing listeners, create a sample project I can use to duplicate the issue.