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

Does this plugin work with anyone? #359

Open
kamhawy4 opened this issue Oct 28, 2021 · 4 comments
Open

Does this plugin work with anyone? #359

kamhawy4 opened this issue Oct 28, 2021 · 4 comments

Comments

@kamhawy4
Copy link

kamhawy4 commented Oct 28, 2021

I found issues dont never fixed .
i dont know if this plugin work or dont?
Does this plugin work with anyone?
i will write my issue However some people wrote about this error before me.
may be anybody help me.

this function wont work QRScanner.scan();

don't display any error but camera won't open

thank you for everyone.

and this is my code

"cordova-android": "^9.1.0"

"cordova-plugin-qrscanner": "^3.0.1",

// html

<button @click="qrPrep();">QR Prepare
<button @click="qrScan01();">QR Scan
<button @click="qrShow();">QR Show

/// js

` qrPrep: function () {

   window.QRScanner.prepare(onDone); // show the prompt
      function onDone(err, status) {
          if (err) {
              // here we can handle errors and clean up any loose ends.
              alert('error');
              console.error(err);
          }
          if (status.authorized) {
              // W00t, you have camera access and the scanner is initialized.
              // QRscanner.show()
              alert('Authorized.'); //This works.
          } else if (status.denied) {
              // The video preview will remain black, and scanning is disabled. We can
              // try to ask the user to change their mind, but we'll have to send them
              // to their device settings with `QRScanner.openSettings()`.
              alert('Denied.');
          } else {
              // we didn't get permission, but we didn't get permanently denied. (On
              // Android, a denial isn't permanent unless the user checks the "Don't
              // ask again" box.) We can ask again at the next relevant opportunity.
              alert('Not permanently denied.');
          }
      }
  },
    qrScan01:function() {
      console.log("Button clicked.");
      QRScanner.scan(displayContents); //this does not work
      //Also tried window.QRScanner - doesn't work either

      function displayContents(err, text) {
          console.log("Entered.");
          if (err) {
              // an error occurred, or the scan was canceled (error code `6`)
              console.log('error', err);
              alert('An error occurred.');
          } else {
              // The scan completed, display the contents of the QR code:
              console.log('text', text);
              alert(text);
          }
      }
  },
 qrShow:function () {
    QRScanner.show(function(status) {
        console.log(status); //this only shows status like authorized: true etc.
    });
  },`
@jamesblunt1973
Copy link

It's not working for me either. my issue is:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0
ionic 5, capacitor, angular, android

@jacobg
Copy link

jacobg commented Nov 25, 2021

I have a fork that hopefully brings this project up to date. Try it out:
https://github.com/jacobg/cordova-plugin-qrscanner/tree/modernize

@jacobg
Copy link

jacobg commented Nov 26, 2021

BTW, I don't think Cordova Android in general yet supports Gradle 8. It's not an issue with this particular plugin:
https://github.com/apache/cordova-android/blob/master/framework/cdv-gradle-config-defaults.json

@amounous
Copy link

amounous commented Nov 28, 2021

After calling QRScanner.scan(displayContents); you have to call directly QRScanner.show();
I was also stuck before calling this method.

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

4 participants