Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"No Tech" when attempting to use Cordova #6

Closed
JohnMcLear opened this issue Aug 5, 2019 · 1 comment
Closed

"No Tech" when attempting to use Cordova #6

JohnMcLear opened this issue Aug 5, 2019 · 1 comment

Comments

@JohnMcLear
Copy link
Contributor

    onDeviceReady: function() {
        this.receivedEvent('deviceready');

        const transceiveFunction = nfc.transceive.bind(nfc);
        const gpcard = new GlobalPlatform(transceiveFunction);

        nfc.addTagDiscoveredListener(function(){

          gpcard.connect().then(() => {
              console.log("connected")
          }).catch(error => {
              console.error(error)
          })
        });

    },

Also attempted

        const transceiveFunction = nfc.transceive.bind(nfc);
        const gpcard = new GlobalPlatform(transceiveFunction);

        nfc.addTagDiscoveredListener(function(){
          nfc.connect('android.nfc.tech.IsoDep', 500).then(
            gpcard.connect().then(() => {
                console.log("connected")
            }).catch(error => {
                console.error(error); // Returns "Not connected"
            })
          )
        });

This returns: TypeError: e.readUInt16BE is not a function(…)nfc.connect.then.gpcard.connect.then.catch.error @ index.js:40

@benbenbenbenbenben
Copy link
Member

readUInt16BE is not a function suggest you're using the wrong version of the code in your build.

readUInt16BE is a Buffer API so you have to use browser/bundle.js or browser/bundle.debug.js for Cordova.

Incidentally, are you working in your fork? You are a few commits behind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants