hypery2k / cordova-barcodescanner-plugin

barcode scanner plugin for PhoneGap
51 stars 39 forks source link

Doesn't work with Phonegap Build #8

Open ilvalerione opened 8 years ago

ilvalerione commented 8 years ago

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).
hypery2k commented 8 years ago

Which phonegap version are you using?

ilvalerione commented 8 years ago

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 commented 8 years ago

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.

hypery2k commented 8 years ago

Can you try if a barcode is working?

ilvalerione commented 8 years ago

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.

mbellotto commented 8 years ago

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

hypery2k commented 8 years ago

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

mbellotto commented 8 years ago

Thank anyway. I figure it out

hypery2k commented 8 years ago

What was the error?

mbellotto commented 8 years ago

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

mabullo commented 7 years ago

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!

Lincolnerson commented 7 years ago

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.

mabullo commented 7 years ago

Hello Lincolnerson, unfortunately the problem remains ...