1

The application so far is just a button that opens the barcode scanner and displays the results when it returns, easy enough. However, when you press the button the following screen shows up: http://i.imgur.com/2XOPLvU.png?1

Restarting my device made no difference. Camera works with other applications that require the use of the camera.

Here is the code for the Controller:

QRKeeper.controller('ScannerController', function($scope, $cordovaBarcodeScanner){

  //Function that runs the scanner 
  $scope.scanCode = function(){

    console.log("Scan button pressed");

      $cordovaBarcodeScanner.scan()
        .then(
          function(response){
            if(!response.cancelled){
              console.log("Scan successful");
            } else {
              console.log("Scan cancelled");
            }
          }, function(error){
            console.log("Error when trying to read code");
          }
        );
  }
});

Wrapping it in deviceready as recommended on the Ionic website made no difference. When executing, chrome://inspect did not show any error logs.

Thank you!

I am using this barcode scanner https://github.com/phonegap/phonegap-plugin-barcodescanner

Using the ngCordova plugin http://ngcordova.com/docs/plugins/barcodeScanner/

Sammy I.
  • 2,523
  • 4
  • 29
  • 49

1 Answers1

0

Someone ended up making a plugin that solved the issue here on Github. I ended up removing the plug-in and adding this one instead:

https://github.com/jrontend/phonegap-plugin-barcodescanner

I could not find out exactly what was the error, I just found out that it had to do with how Android asks for app permissions in the newer versions.

Sammy I.
  • 2,523
  • 4
  • 29
  • 49