Cordova: sorry the android camera encountered a problem

When I build for android with cordova plugin "cordova-plugin-barcodescanner" after launching camera it is giving me error like below:

sorry, the android camera encountered a problem. you may need to restart the device

cordova-camera issue

My environment detaiils:

Platform : android 6.2.3

device: MI Note 4 with MIUI 8.5

Cordova : 7.0.1

plugin: cordova-plugin-barcodescanner

After google, found that it is permission issue with android 6. So to fix the issue I configure platform to android 5.0 but it does not work for me. Then I figure out that there is another permission required in MIUI secruity system and after enabling it, camera started working.

Following are the steps you can follow to update the setting:

1) Go to Security.

2) Click on "Permissions" and again select "Permissions"

3) Now from the list, click on "Camera".

4) It will list all the apps installed. Look for your app and enable the permission.

Now try to run the application again it should launch the camera to read code.

Hope someone will benefit by this. Not sure, this issue might be with Xiaomi specifically.




Your feedbacks are most welcome..