App crashes after Barcode Scanner read (ngCordova)


I just installed the Barcode Scanner Plugin following exactly the steps at http://ngcordova.com/docs/. So I run ‘ionic run android’ and when I test on my device the scan seems to be ok, but after the scanning the app closes by itself.

Here is my controller code:

.controller('PontuarCtrl', function($scope, $cordovaBarcodeScanner) {

$scope.scanBarcode = function() {
	$cordovaBarcodeScanner.scan().then(function(imageData) {
		alert('SUCESS: '+imageData);
	}, function(err) {
		alert('ERROR: '+err);
	});
};

})

I’ve searched the web and i found out that its because the scanner changes the orientation of the app when its called. Then I changed the activity orientation in the AndroidManifest.xml but doesnt work :confused:

Someone have dealt with it or have any idea what is happening?

(*Sorry for my english ;x, i’m brazilian…).

Please someone help me! D: I have no idea how to solve it :confused:

@lucasalmeida There was an error in the ng-cordova code for the Barcode Scanner Plugin.

It’s fixed now 2f93e22 and should be working fine. You can download the latest using bower install ngCordova

First of all, thanks for the answer! :smile:

…BUUT my ngCordova had not that error in the file ‘src/plugins/barcodeScanner.js’ :confused:

I tried using bower but its not working :confused: