tjwoon / cszbar Goto Github PK
View Code? Open in Web Editor NEWCordova plugin to integrate with the ZBar barcode scanning library.
License: Other
Cordova plugin to integrate with the ZBar barcode scanning library.
License: Other
Is it possible to add support for Windows (Phone, Store, Universal)?
Thanks
IAndonov
I am running Xcode 7.1, and Cordova 5.3.3. If I create a new project, inject the plugin, and attempt to compile I get the error:
linker command failed with exit code 1 (use -v to see invocation)
If I remove the plugin, it compiles fine.
hello
is it possible to add support for pdf417
Hi @tjwoon ,
I have been playing around with this plugin and have successfully added a "capture" button to the Android code, allowing the user to simply press capture if they are unable to retrieve the barcode in an acceptable time. The Android version of the plugin then returns the byte array retrieved at that time to the javascript.
Is this possible to do for the iOS version? I am not very versed in using Objective C and am mainly a java developer so the Android portion was ok.
I've tested on various devices (Android 4.4.4, 4.4.3 and 5.0.2), when I call cloudSky.zbar.scan() the app immediately crashes. Looks like iconv cannot be loaded.
Here's the logcat:
Class init failed in newInstance call (Lorg/cloudsky/cordovaPlugins/ZBarScannerActivity;)
D/AndroidRuntime( 5388): Shutting down VM
W/dalvikvm( 5388): threadid=1: thread exiting with uncaught exception (group=0x41611d40)
E/AndroidRuntime( 5388): FATAL EXCEPTION: main
E/AndroidRuntime( 5388): Process: com.ionicframework.myapp119689, PID: 5388
E/AndroidRuntime( 5388): java.lang.UnsatisfiedLinkError: Couldn't load iconv from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.ionicframework.myapp119689-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.ionicframework.myapp119689-1, /vendor/lib, /system/lib]]]: findLibrary returned null
E/AndroidRuntime( 5388): at java.lang.Runtime.loadLibrary(Runtime.java:358)
E/AndroidRuntime( 5388): at java.lang.System.loadLibrary(System.java:526)
E/AndroidRuntime( 5388): at org.cloudsky.cordovaPlugins.ZBarScannerActivity.(ZBarScannerActivity.java:68)
hi @tjwoon
according to these
http://phonegap.com/blog/2015/05/26/npm-plugins-available/
http://cordova.apache.org/announcements/2015/04/21/plugins-release-and-move-to-npm.html
so...just want to inform you that your plugin should be move to npm in the future...
Sorry invalid questions.
I installed my app on a Nexus 5x with Android 6.0.1 but when i call this plugin to open scanner the app go shoutdown.
Someone knows this problem?
Do you support 64bit on iOS. Just did a test and I am getting:
Undefined symbols for architecture arm64:
"OBJC_CLASS$_ZBarReaderViewController", referenced from:
objc-class-ref in CsZBar.o
"_ZBarReaderControllerResults", referenced from:
-[CsZBar imagePickerController:didFinishPickingMediaWithInfo:] in CsZBar.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Hi,
Thanks a lot for creating such a good plugin. I invoked the plugin with the following command and it works like a charm.
cloudSky.zBar.scan("",
function (result) {
resultDiv.innerHTML = result;
}, function (error) {
alert("Scanning failed: " + error);
}
)
I just want to know, is there any provision for choosing the front camera and enabling the flash light for rear camera??
I'm working in a project, in which I need to be able to scan EANs, which are placed next to each other. I tried and modified the official phonegap plugin, which uses Zxing instead, but had problems in iOS. This however works pretty smoother in scanning small EANs in iOS, so I wanted to know, if there's a way to customize the scanning area, so it'd be just a small rectangle in the screen instead of the whole screen.
Best Regards
The load time is great on iOS, but in Android it's quite deplorable, and is a blocker on releasing our project to the app stores. On inspection of the Java code I discovered that some of the initialization happens after the user triggers the camera to load and that these instructions can be executed much earlier, improving camera load time.
I'm very inexperienced (as in... 0 hours) as a Java developer and couldn't figure out if my above assumption about optimization is true or not.
To sort this out sooner rather than later, I've created a job on odesk (now upwork?) at the highest pay tier, in case anyone here is interested in helping out: https://www.upwork.com/c/jobs/~0108a70bf8a5e3b867
hi, guys, after scan more than 6 times, the app will unresponsive, the moniter show it cost too many cpu and memory, the log is below, can some body help me, thanks very much.
2016-02-24 19:32:20.506 xy[1516:60b] Apache Cordova native platform version 3.8.0 is starting.
2016-02-24 19:32:20.515 xy[1516:60b] Multi-tasking -> Device: YES, App: YES
2016-02-24 19:32:28.891 xy[1516:60b] Finished load of: file:///var/mobile/Applications/15A8AC9A-E4E9-43FB-890B-148933D68A1A/xy.app/www/index.html
/* the first time start the scanner */
2016-02-24 19:32:43.334 xy[1516:60b] THREAD WARNING: ['CsZBar'] took '270.422852' ms. Plugin should use a background thread.
2016-02-24 19:32:54.934 xy[1516:60b] 0
/* the second time start the scanner */
2016-02-24 19:32:57.684 xy[1516:60b] THREAD WARNING: ['CsZBar'] took '85.388916' ms. Plugin should use a background thread.
2016-02-24 19:33:00.750 xy[1516:60b] 0
2016-02-24 19:33:00.753 xy[1516:60b] 1
/* the third time start the scanner */
2016-02-24 19:33:02.060 xy[1516:60b] THREAD WARNING: ['CsZBar'] took '165.236084' ms. Plugin should use a background thread.
2016-02-24 19:33:05.135 xy[1516:60b] 0
2016-02-24 19:33:05.137 xy[1516:60b] 1
2016-02-24 19:33:05.139 xy[1516:60b] 2
/* the fourth time start the scanner */
2016-02-24 19:33:06.519 xy[1516:60b] THREAD WARNING: ['CsZBar'] took '531.569824' ms. Plugin should use a background thread.
2016-02-24 19:33:10.419 xy[1516:60b] 0
2016-02-24 19:33:10.421 xy[1516:60b] 1
2016-02-24 19:33:10.424 xy[1516:60b] 2
2016-02-24 19:33:10.425 xy[1516:60b] 3
/* the fivth time start the scanner */
2016-02-24 19:33:13.097 xy[1516:60b] THREAD WARNING: ['CsZBar'] took '2121.730225' ms. Plugin should use a background thread.
2016-02-24 19:33:17.486 xy[1516:60b] 0
2016-02-24 19:33:17.488 xy[1516:60b] 1
2016-02-24 19:33:17.490 xy[1516:60b] 2
2016-02-24 19:33:17.491 xy[1516:60b] 3
2016-02-24 19:33:17.493 xy[1516:60b] 4
/* the sixth time start the scanner */
2016-02-24 19:33:28.706 xy[1516:60b] THREAD WARNING: ['CsZBar'] took '9726.516846' ms. Plugin should use a background thread.
2016-02-24 19:33:30.041 xy[1516:4703] void SendDelegateMessage(NSInvocation *): delegate (webView:decidePolicyForNavigationAction:request:frame:decisionListener:) failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode
2016-02-24 19:33:36.819 xy[1516:60b] 0
2016-02-24 19:33:36.820 xy[1516:60b] 1
2016-02-24 19:33:36.822 xy[1516:60b] 2
2016-02-24 19:33:36.823 xy[1516:60b] 3
2016-02-24 19:33:36.825 xy[1516:60b] 4
2016-02-24 19:33:36.826 xy[1516:60b] 5
I am trying to show the main cordova window on top of the activity but fail. Anyone have a quick fix? I tried to rewrite activity to a fragment but dose not seem to do the trick.
hi @tjwoon
I just wanted to congratulate you on this awesome plugin. I tried several other barcode scanners for cordova and they all fail or missing features! I'm using it on ios 8.3 and it works great!
thank you for your awesome work!
dp
The readme says:
cordova plugin add org.cloudsky.cordovaplugins.zbar
However that doesn't work, the following does work however, assuming this is the same project as this, it should be changed in the readme.
cordova plugin add org.madmobile.cordovaplugins.zbarscanner
10% of cases, when you get a good clear view of the QR code, it will not scan. It's smack in the middle of the green rectangle, properly aligned yet it won't detect it.. Not moving.
Yet when I move in the paper with the QR code on it from far, bring it closer, most of the time it will detect it. So why wouldn't it detect a completely still close-up QR code better than the moving from afar QR code?
The default camera overlay uses string values in csZbarScannerTitle and csZbarScannerInstructions that mention a "QR code". I would like to use different string values on the screen.
Each time I run a 'cordova build' it appends or changes the tags in strings.xml with the defaults for those 2 tags as:
Scan QR Code
Please point your camera at the QR code.
I have changed plugins.xml with correct values and those show up in strings.xml, however the ones mentioned above also get appended... and used by the plugin instead of mine.
I have found if I "cordova prepare", then edit strings.xml, then do a "cordova compile" then I get to keep my string values.
Is there a way that I can use "cordova build" without losing my string values to the defaults?
Hi,
Thanks for your work on this plugin. This is not an issue, but a request. I was wondering if you are able to return the scanned barcoded data as well as the barcode type, e.g. QR, EAN13, etc.
Regards,
Eric
this plugin only scan qrcode in android?
I'm getting a few crash reports (in google play console), but don't have a device to reproduce it myself and I don't understand the trace either.
Figured I'd put it up here to find out if this is something that is your concern and/or aware of this or just something I did wrong etc.
Android 5.1
Galaxy S6 Edge (zerolte)
Galaxy S6 (zeroflte)
Galaxy S6 Edge (zeroltetmo)
Galaxy S6 (zerofltetmo)
Android 5.0
c218v13_jbaol_3m_fhd_elephone
HTC ONE M8s (htc_m8qlul)
Yureka (YUREKA)
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.blocktrail.mywallet-1/base.apk"],nativeLibraryDirectories=[/data/app/com.blocktrail.mywallet-1/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "libiconv.so"
at java.lang.Runtime.loadLibrary(Runtime.java:366)
at java.lang.System.loadLibrary(System.java:988)
at org.cloudsky.cordovaPlugins.ZBarScannerActivity.<clinit>(ZBarScannerActivity.java:77)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.Class.newInstance(Class.java:1684)
at android.app.Instrumentation.newActivity(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2954)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3218)
at android.app.ActivityThread.access$1000(ActivityThread.java:198)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1676)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6837)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
I can't generate a build of Android because it throws the next error:
:mergeDebugResources
:processDebugManifest/myproject/platforms/android/AndroidManifest.xml:81:5 Error:
Element uses-feature#android.hardware.camera at AndroidManifest.xml:81:5 duplicated with element declared at AndroidManifest.xml:80:5
myproject/platforms/android/AndroidManifest.xml:0:0 Error:
Validation failed, exiting
FAILED
FAILURE: Build failed with an exception.
I tried with commenting the <uses-feature android:name="android.hardware.camera" />
in the plugin xml file, and it still with the same error.
Android version works as advertised.
iOS version never calls either callback. That is, if I scan a barcode, the scanner just goes away, doesn't call onSuccessCallback. If I cancel, the scanner just goes away, doesn't call onFailCallback.
Using Web inspector to watch the app's console messages, I see it console.log() output a message just before calling scan().
On cancel or successful scan, I get:
[Error] SyntaxError: Unexpected EOF
(anonymous function) (index.html, line 1)
Identical code running on android and iOS (the javascript/html/css bits).
I think there's an access violation in the ObjC code. I'm not an ObjC guy.
Please fix this ASAP ;)
I was using scandit barcode scanner. But it stopped working with cordova 4.0+. I have installed yours and I can open the scanner, but I after the scan, it goes back to the app, showing no result. My code is:
cloudSky.zBar.scan("",
function (s) {
alert(s);
},
function (s) {
alert("Scanning failed: " + s);
}
Hi,
Could you please provide a sample code for Ionic Framework? I have the following and it is not working. Thank you!
$scope.scan = function(){
window.cloudSky.zBar.scan(params, onSuccess, onFailure).then(function(result){
alert(result);
},function(error){
alert(error);
});
}
To do so, add the following to the scan method in CsZbar.m:
ZBarImageScanner *scanner = self.scanReader.scanner;
[scanner setSymbology:0 config:ZBAR_CFG_ENABLE to:0];
[scanner setSymbology: ZBAR_QRCODE
config: ZBAR_CFG_ENABLE
to: 1];
(under self.scanReader = [AlmaZBarReaderViewController new];)
Now only QR codes area able to be scanned..
(PS:Sorry for not using pull requests.. hope you can still integrate these features) (with some more configuration of course).
Codes:
ZBAR_NONE = 0, /**< no symbol decoded */ ZBAR_PARTIAL = 1, /**< intermediate status */ ZBAR_EAN2 = 2, /**< GS1 2-digit add-on */ ZBAR_EAN5 = 5, /**< GS1 5-digit add-on */ ZBAR_EAN8 = 8, /**< EAN-8 */ ZBAR_UPCE = 9, /**< UPC-E */ ZBAR_ISBN10 = 10, /**< ISBN-10 (from EAN-13). @since 0.4 */ ZBAR_UPCA = 12, /**< UPC-A */ ZBAR_EAN13 = 13, /**< EAN-13 */ ZBAR_ISBN13 = 14, /**< ISBN-13 (from EAN-13). @since 0.4 */ ZBAR_COMPOSITE = 15, /**< EAN/UPC composite */ ZBAR_I25 = 25, /**< Interleaved 2 of 5. @since 0.4 */ ZBAR_DATABAR = 34, /**< GS1 DataBar (RSS). @since 0.11 */ ZBAR_DATABAR_EXP = 35, /**< GS1 DataBar Expanded. @since 0.11 */ ZBAR_CODE39 = 39, /**< Code 39. @since 0.4 */ ZBAR_PDF417 = 57, /**< PDF417. @since 0.6 */ ZBAR_QRCODE = 64, /**< QR Code. @since 0.10 */ ZBAR_CODE93 = 93, /**< Code 93. @since 0.11 */ ZBAR_CODE128 = 128, /**< Code 128 */
It would be great if we could define "Cancel" button translation from calling the plugin from our function.
thank you
Davor
Can we make this a configurable parameter?
Hi,
I would like to be able to cancel scanning from the app, basically trigger "Cancel" button function from my app.
thank you
iOS 9.2, and the params I set is below:
var params = {
camera: "back", // defaults to "back"
flash: "off", // defaults to "auto". See Quirks
drawSight: true, //defaults to true, create a red sight/line in the center of the scanner view.
};
In Android, the red line displays well, and is horizontal, but in iOS, it is vertical.
How can I fix this bug?
I have an issue when I try to rescan the same Qr Code, the scanner never exit but call the callback. It works good on Android but not IOS I have to click the cancel button to exit the view.
The iphone logs:
Attempt to dismiss from view controller <MainViewController: 0x1576487a0> while a presentation or dismiss is in progress!
Hi,
I am new to cordova. can you refer any examples or reference to add this plugin properly to the app.
Statusbar is always showing when the camera is open, can I hide it somehow? I tried with cordova plugin, but it's not doing anything, it stays during camera open.
I am developing a new app which require Barcode scan. I added the plugin successfully and tried to run on iOS device but could not succeeded.
There is no way to pass configuration to scan as UPC-12
i want to close the preview by double tapping anywhere in the activity but no touch event is fired. Have anyone found out how to get those to fire? The best will be to make it possible to interact with webview.
Having the camera view still running (while it is closing) AFTER the onSuccess
callback is called means other plugins such as cordova-plugin-dialog
won't work and have an internal violation.
This typically means I have to add a setTimeout(..., 1000)
to my QR scanner to avoid the application from failing to re-open those plugins.
The simplest example of this would be (using cordova-plugin-dialog
):
cloudSky.zBar.scan({}, function () {
window.navigator.alert('This fails', function () {}, 'Text', 'OK')
}, functoin () {
setTimeout(function () {
window.navigator.alert('But this works... until you do the other one', function () {}, 'Text', 'OK')
}, 1000)
})
I really like this plugin but when I build it on ios8 iphone5s with a error
ld: warning: ignoring file /Users/apple/eee/platforms/ios/eee/Plugins/org.cloudsky.cordovaplugins.zbar/libzbar.a, missing required architecture x86_64 in file /Users/apple/eee/platforms/ios/eee/Plugins/org.cloudsky.cordovaplugins.zbar/libzbar.a (3 slices)
Undefined symbols for architecture x86_64:
"OBJC_CLASS$_ZBarReaderViewController", referenced from:
objc-class-ref in CsZBar.o
"_ZBarReaderControllerResults", referenced from:
-[CsZBar imagePickerController:didFinishPickingMediaWithInfo:] in CsZBar.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Hi , I use your plugin in my PhoneGap project , it works well , except on Sony XL39h !
Follow is my code:
cloudSky.zBar.scan( {} , alert , alert );
When I call .scan()
method , mobile will open camera , but then it alert me "Sorry , App has been crashed" , and I click OK
, then the app auto restart.
I hope you can fix it :)
Does this plugin use xzing (Zebra Crossing) ?
I'm looking for an alternative of https://github.com/wildabeast/barcodescanner which uses xzing, and it's conflicting with another plugin that I use in my Cordova project.
Even this plugin fails to install on Intel XDK, but I'm waiting to receive a better error log to know why it doesn't compile.
Hello
I m trying everything but my app crash on ios regularly , it seams to be often when i try the barecodescanner just after having close the app and reopen it.
I find this to be very strange , everything works perfectly but the flash : "on" parameter has no effect .
I have the same problem
when I use
cordova plugin add org.cloudsky.cordovaplugins.zbar
cordova build android
it will show the error message
http://www.littlebau.com/cli/nativepagetransitions_cli.gif
I think ios maybe have the similar problem
On iOS, I'm having this problem:
Any ideas?
Hey, this isn't exactly an issue but I couldn't find a way to just message you.
I'm looking to modify this slightly but everything I've seen with zBar SDK online doesn't match what exists in this repo. I'm wanting to add a vertical centered red line overlay to the scanner and also limit it to only read Code 128. How can I do this?
Thank you so much for your time spent working on this, it will really help my business once everything is flushed out in my app.
Matthew Walker
The bar where the cancel button is is much higher than the "cancel" button text itself, (like 1.5 times). Why is it so big and can it be reduced in size? It's the little details that matter... ;)
On my Nexus 5 (API Level 22), the flashlight keeps going on and off when option is set to "on".
The quirks mention this behaviour on Android <14, however, this is in my AndroidManifest:
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="22" />
Changing the minSdkVersion to 22 doesn't change this behaviour... I can't get it to stay on. I'm using Ionic Framework.
If we can remove this requirement from the AndroidManifest, we can support more devices.
Can it be done? Need to research more on android.hardware.camera.autofocus() behaviour when autofocus is not available, etc.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.