I'm developing in Ionic Framework.The barcodeScanner plugin(ngCordova) doesn't work for the newest version of Android. I suspect the plugin is not updated for this version. Any of you have found a solution? Thanks.
-
are you getting any error on installing ngCordova barcodescanner plugin – Mohan Gopi Apr 13 '16 at 09:22
-
No, I'm not. I installed the apk in Android 5 and the plugin runs correctly... – Samuel Paredes Apr 13 '16 at 09:40
-
send me your code so that i will try to understand what is going on – Mohan Gopi Apr 13 '16 at 09:43
-
I'm calling to this function in the view :$scope.readCode = function() { $cordovaBarcodeScanner.scan().then( function(imagenEscaneada) { alert(imagenEscaneada.text); }, function(error){ alert('An error has ocurred: ' + error); } ); }; – Samuel Paredes Apr 13 '16 at 16:29
-
problem resolved. :) – Samuel Paredes Apr 13 '16 at 16:41
5 Answers
Samuel Paredes, There is many change in Android 6(M) , the main is runtime permissions, so we need the camera for the barcode scanner , but the plugin is not yet updated for that so we need to On the Camera permisson for the application manuully.
Setting >> APP manager >> Your App >> Permissions >>Camera >>
Please enable the camera permission from there. Hope it will help you

- 2,301
- 24
- 33
-
Is there a way to make our application request the camera permissions? – Sammy I. Apr 15 '16 at 03:03
-
Yes, there is a way , we need to customise our plugin for barcode scanner to access permissions – A-Droid Tech Apr 15 '16 at 04:21
-
@A-DroidTech how can I do to ask permissions on app installation?? My app isn't working because user has no access to the camera...thanks! – pekpon Apr 20 '16 at 11:19
We have this problem too. To solve it we have done this : ionic platform add android@4.1 and it solve the problem

- 179
- 4
I have this problem: Sorry, the android camera encountered a problem. You may need to restar the device

- 111
- 1
- 10
Droid Tech, will this be resolved in the near future? Is there some way to monitor or to get a notification when this bug is solved?

- 39
- 5
Same error happened to me. A guy on Github forked the plug-in and fixed it, take a look here.
basically, remove the barcode scanner plugin you have right now and add the new one like this:
cordova plugin add https://github.com/jrontend/phonegap-plugin-barcodescanner
It works exactly the same way.

- 2,523
- 4
- 29
- 49