S.M.Priya
S.M.Priya

Reputation: 364

Barcode scanner plugin is not working in android Marshmallow ionic?

I am developing my ionic app using ngCordova. I have installed camera plugin by using,

cordova plugin add org.apache.cordova.camera

Then, I have installed barcode scanner plugin by using,

cordova plugin add https://github.com/phonegap/phonegap-plugin-barcodescanner.git

While running my ionic app it's asking for camera permission. I have allowed the permission also. so, I can able to capture the image.

But, by opening the barcode scanner,

    $cordovaBarcodeScanner.scan().then(function(imageData) {
        alert(imageData.text);
        alert("Barcode Format -> " + imageData.format);
        alert("Cancelled -> " + imageData.cancelled);
    }, function(error) {
        alert("An error happened -> " + error);
    });

I can able to opening scanner. I am not able to get the result. scanner is not scanning the barcode..

The same plugin is working for me for android 5+ versions.

Anyone help will be Appreciated!!!!

Upvotes: 2

Views: 1589

Answers (1)

M. Junaid Salaat
M. Junaid Salaat

Reputation: 3783

A potential workaround is to change your target sdk version to 22 (Lollipop) instead of 23 (Marshmallow).

Try this in config.xml

<platform name="android">
        <preference name="android-targetSdkVersion" value="22"/>
</platform>

OR

For Android platforms/android

In platforms/android/AndroidManifest.xml change to:

<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="22" />

In platforms/android/prodject.properties change to:

target=android-22

For more try following this issue thread

Hope this helps.

Upvotes: 1

Related Questions