cordova-barcodescanner-plugin icon indicating copy to clipboard operation
cordova-barcodescanner-plugin copied to clipboard

Doesn't work with Phonegap Build

Open ilvalerione opened this issue 9 years ago • 13 comments

Hello, I'm trying to use this plugin in my ionic project compiled with PhoneGap Build.

When i try to use barcode scanner on iOS devices, my app open barcode correctly but doesn't scan (capture) qrcode.

My config.xml declaration is gap:plugin name="cordova-plugin-barcodescanner" source="npm"

and my test code is: cordova.plugins.barcodeScanner.scan( function (result) { if(result.cancelled) return; alert(result.text); }, function (error) { alert("Error scan"); });

Have you notice of the same problem.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/30947259-doesn-t-work-with-phonegap-build?utm_campaign=plugin&utm_content=tracker%2F12908089&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F12908089&utm_medium=issues&utm_source=github).

ilvalerione avatar Feb 17 '16 15:02 ilvalerione

Which phonegap version are you using?

hypery2k avatar Feb 17 '16 17:02 hypery2k

Hello @hypery2k

In my app on PGB i see

PhoneGap (iOS / Android / Windows) cli-5.2.0 (3.9.1 / 4.1.1 / 3.8.1)

3.9.1 on iOS? I'm not sure.

ilvalerione avatar Feb 17 '16 17:02 ilvalerione

I tried using old version of cli (5.1.1).

In my PGB app there is PhoneGap (iOS / Android / Windows) cli-5.1.1 (3.8.0 / 4.0.2 / 3.8.1)

Nothing change. When i try to use barcode scanner on iOS device, my app open barcode correctly but doesn't scan (capture) qrcode.

ilvalerione avatar Feb 18 '16 10:02 ilvalerione

Can you try if a barcode is working?

hypery2k avatar Feb 18 '16 17:02 hypery2k

I tested all possible, but nothing.

This code example opens QrCode scanner correctly, but when i aim it in front of QrCode it doesn't do scan.

I change inclination and distance, i try with differents QrCode.... nothing... it doesn't capture code.

Only in iOS devices, android works well.

I tested app with two devices: iphone 6 with iOS 9.2 iphone 5s with iOS 9.2

and them behavior is the same.

Actually i'm using another plugin that seems to work well.

ilvalerione avatar Feb 18 '16 17:02 ilvalerione

I have a similar problem with PDF417 codes. Opens the camera, start searching the code but never read it.

1D Barcode and QG works fine. Is there any special config for PDF417? Also, is there any chance to enlarge scanning area in the screen?

Thanks.

P.S. The problems is present in all platforms

mbellotto avatar Feb 24 '16 19:02 mbellotto

I'm not really sure were the problem ist. But currently I'm busy with other stuff

hypery2k avatar Feb 25 '16 04:02 hypery2k

Thank anyway. I figure it out

mbellotto avatar Feb 25 '16 05:02 mbellotto

What was the error?

hypery2k avatar Feb 25 '16 07:02 hypery2k

Hi Martin.

Sorry, but I was in a hurry trying to deliver a prototype to a client.

It was more a setup/config problem than an error.

It seems that Zxing does not detect PDF417 by default, It must be setup.

My first attempt was to hardcode a

intentScan.putExtra("SCAN_FORMATS","PDF_417");

as a Stackoverflow Q&A suggest. But it didn't work.

Then I noticed they were talking about phonegap-plugin-barcodescanner. I compared your code with them, and found that your BarcodeScanner.java scan function doesn't accept a config arg.

I analyzed both codes and found phonegap-plugin-barcodescanner let me configure Zxing from the javascript code.

So, I change the plugin.

It will be nice to have this feature in your plugin.

Hope this help

mbellotto avatar Feb 25 '16 15:02 mbellotto

Hi hypery2k , i have the same problem with android. When i test the app with PhoneGap Developer app on my android (version 6.0.1) works fine: the app open barcode correctly and i can save the value. The problem is on the .apk generated by PhoneGap Build. When i try to scan, the view of scanning is in landscape and the scanner can't retrive the value of the barcode(QR_CODE, EAN_13 ecc..). You can find the code here and the .apk at this link

Thanks!

mabullo avatar Aug 24 '16 10:08 mabullo

Hi Mabullo, Is your problem solved? I need to scan PDF417 but facing same issue. It reads and gives wrong number. Cordova is new for me.

Following is my code: cordova.plugins.barcodeScanner.scan( function (result) { $("#permitnbr").val(result.text); $( "#searchButton" ).trigger( "click" ); }, function (error) { alert("Scanning failed: " + error); }, { "preferFrontCamera" : false, // iOS and Android "showFlipCameraButton" : true, // iOS and Android "prompt" : "", // supported on Android only "formats" : "QR_CODE,PDF417", // default: all but PDF_417 and RSS_EXPANDED "orientation" : "landscape" // Android only (portrait|landscape), default unset so it rotates with the device } );

Thanks in advance.

Lincolnerson avatar Aug 26 '16 12:08 Lincolnerson

Hello Lincolnerson, unfortunately the problem remains ...

mabullo avatar Sep 16 '16 09:09 mabullo