chariotsolutions / phonegap-nfc

PhoneGap NFC Plugin
MIT License
706 stars 556 forks source link

Ingnoring NFC listener #277

Closed betancourtfran closed 7 years ago

betancourtfran commented 7 years ago

Dear Don.

I've been adding some tag listeners but after successfully writing something to the ndef tag I ain't capable of removing them using the methods provided by chariot solutions's plugin, even though I navigate to another page, they keep listening. Here is one of the listeners I'm using in my code:

nfc.addMimeTypeListener(functionWhereDataIsPrepared, () => { alert("mime listener added"); // code for writing the data into ndef tag and after that, navigate to another page })

// this remove method is called just after leaving the page

nfc.removeMimeTypeListener("application/json", functionWhereDataIsPrepared, () => { alert('mime listener removed'); }, () => { alert('mime listener not removed'); });

I don't know if the problem is the previously registered callback. I've read another answer you gave about this issue where you recommend ignoring the listeners instead of removing them, but I don't know how to do that. I'm using Ionic 2. Pardon my English