chariotsolutions / phonegap-nfc

PhoneGap NFC Plugin
MIT License
706 stars 559 forks source link

Plugin does not read nfc tag on android tablet v4.0.4 with RFID reader. #193

Closed Kristi91 closed 9 years ago

Kristi91 commented 9 years ago

I have an Android 4.0.4 tablet with RFID reader. When i use NFC Reader application from Play Store and scan for tags i get the information. I tried to read it using the plugin but it doesn't work. I have used : nfc.addTagDiscoveredListener, nfc.addNdefFormatableListener, nfc.addNdefListener to listen for events. The event listeners are registered because i get the callback that is called when the listener is added, but nothing comes up when i place the tag on the scanner. The code i used:

        nfc.addNdefFormatableListener(function (result) {
            alert( "Listener 3 activated " + JSON.stringify(result));
        }, function () {
              alert("Listener 3 OK");
         }, function () {
                    alert("Listener 3 ERROR");
        });

        nfc.addTagDiscoveredListener(function (result) {
                alert( "Listener 2 activated " + JSON.stringify(result));
            }, function () {
                 alert("Listener 2 OK");
            }
            , function () {
                alert("Listener 2 ERROR");
            });

        nfc.addNdefListener(function (result) {
            alert( "Listener 1 activated " +JSON.stringify(result));
        }, function () {
            alert("Listener 1 OK");
        }, function () {
            alert("Listener 1 ERROR");
        });

What can i do? Best Regards.

Kristi91 commented 9 years ago

I solved it, it was another issue :"Converting circular structure to JSON", the object that was returned had circular structure, that was causing the error.