Forum Cross Platform with Xamarin

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

ZxingSharp.Mobile - Cross Platform Barcode Scanning

124

Posts

  • SeanThomasSeanThomas CAMember

    Here are some more examples, hopefully these work, if not I can upload the original pics.

  • antoniolopesantoniolopes GBMember

    Hey @Redth,

    Good to know this thread is going on with lots of activity!

    Im about to jump in into the source code of Zxing. Have you ever tried to change the ROI for the detector?

    Before i start seeing the full code i just wanted to ask if you know this already and where should i focus.

    Hope to hear from you!

    Regards

  • OldRedthOldRedth USMember, Insider ✭✭✭

    @antoniolopes I have not done too much with the underlying ZXing.Net project that @micjahn created and maintains. I am thinking about making a simple desktop app to test barcode images and see if we can get the barcodes decoding without adding the mobile scanner into the mix (remove some variables), and work from there.

  • antoniolopesantoniolopes GBMember

    Hi @Redth,

    I changed it. Its fairly easy. If you need any help in debugging and getting into stuff just give me a shout! I've been focusing in datamatrix because we just work with that but i imagine that the rest is fairly easy to understand also:)

    Cheers

  • SeanThomasSeanThomas CAMember

    Bump?

  • OldRedthOldRedth USMember, Insider ✭✭✭

    @spthomas sorry I have had 0 time to work on ZXing in the last week or two... I did try scanning your images, and they don't scan for me either, but i suspect they're just tricky to scan... I've got to remember to try scanning my car's VIN next time I'm around it though...

    Curious though, have you experimented with RedLaser or others? I'm interested if they do any better...

  • OldRedthOldRedth USMember, Insider ✭✭✭

    @spthomas actually, this got me intrigued enough to run out quick and try android on my car. It worked really well and quite fast.

  • Ignacio.6990Ignacio.6990 USMember

    Hello Redth, I tried reading the bar coding pdf417 of identity card Chilean with your library but it has been impossible, may you help me with this?
    In advance thank you very much.

  • OldRedthOldRedth USMember, Insider ✭✭✭

    @Ignacio.6990 would need a sample image to help at all. But also there are some PDF417 improvements coming soon, so keep checking back for those updates!

  • SeanThomasSeanThomas CAMember

    @Redth I've used the XZing (this) and it works every time.

    The problem I'm having is with the variety of VIN stickers/placements out there I cannot get a consistent scan. Now, mind you this could be user error in the code. :)

    I was trying to base it off of the sample app found in Git pull; of course there are a number of options and wasn't sure if a specific combination would work better.

    With something that's particularly long like this would the overlay matter? Or the orientation of the scanner?

  • SeanThomasSeanThomas CAMember

    Excuse my ignorance, but is there anyway to use a 3rd party scanner in Xamarin? I believe this is possible in btouch with iOS.

  • OldRedthOldRedth USMember, Insider ✭✭✭

    @spthomas you can bind RedLaser for both platforms if you like, but of course that's a non free solution.

    So you are talking specifically about iOS then having problems? Have you tried on Android? I ask because iOS seems to be a bit worse at detecting barcodes, but this is improved in the github repo, but has not been released to the component store yet, so you should try the source code: https://github.com/Redth/ZXing.Net.Mobile

  • SeanThomasSeanThomas CAMember

    @Redth What is the cost in the binding? What if I used the ZXing app?

    The issues I'm having are actually with Android. I've used a GSII and GSIII in my testings.

  • SeanThomasSeanThomas CAMember

    Again, excuse the noobieness of these questions. Still taking a bit to get my head completely wrapped around Xamarin (no pun intended).

  • JamesLaveryJamesLavery GBBeta, University ✭✭✭✭✭

    @spthomas I may be slightly off topic here but interpreting your question as 'separate scanner to the phone camera...'

    We're using a separate scanner for our application. We need industrial-strength reliability - i.e. scanning successfully every time.

    For business/technical reasons, we're scanning laser-etched DataMatrix around 5mm square on a plastic water filter. We found that using the camera wasn't reliable enough - especially given the practical challenges of being able to view the screen to get the scan focussed etc. In addition, when making scores or hundreds of scans a day, phone battery life is likely to be a problem.

    Therefore we're using the Koamtac KDC300i, which connects with the iPhone via bluetooth. It has Android and iOS SDKs - we're using it on iOS.

    We had to bind the native library which comes with the scanner; the solution works really well, and our customer is about to go live with it after successful field trials.

    For backup, we have also incorporated @Redth's library to use the camera, and this is functioning acceptably (no disrespect to @Redth's work!), given the challenge of small, low-contrast DataMatrix. We found that reliability improved massively when we configured the library to only look for DataMatrix rather than auto-detect.

    The one downside is cost - the KDC300i costs more than the phone!

    Hope this helps.

    James

  • OldRedthOldRedth USMember, Insider ✭✭✭

    @JamesLavery thanks for sharing your experiences. Definitely a 5mm Data Matrix is a tough thing for a camera to scan. I think you make a good point about external scanners though. Sometimes it's just the right choice to go that route if you have an application that relies primarily on scanning barcodes all day (battery, accuracy, time to acquire barcode, etc.). I don't think ZXing.Net.Mobile is a perfect replacement for these cases, and I'd definitely encourage people to consider these hardware scanners if they are using devices as a dedicated scanning tool.

    I love the idea of having ZXing.Net.Mobile as a 'backup' for these scenarios though, and there were some other folks I got to meet at Evolve that were doing something similar.

  • OldRedthOldRedth USMember, Insider ✭✭✭

    @JamesLavery also, if you are keeping track, I've committed some source lately to ZXing.Net.Mobile that really improves iOS startup/scanning speeds. Performance is something I'm going to continue to work on, but there's only so much a camera can do. Should have an update coming to the component store in the next few weeks.

  • SeanThomasSeanThomas CAMember

    @JamesLavery The problem is my client base, automotive dealers generally are cheap and lazy, thus they need an all-in-one solution. To top it off the competition out there has similar apps that do the scanning natively.

    @Redth I have complete faith that the ZXing.Mobile will do the trick, as we've both stated it does work, it's just tweaking it to work in the majority of situations. Maybe the binding (to another app like RedLaser) would be a good backup for my solution.

  • SeanThomasSeanThomas CAMember

    @Redth Do you have any resources for binding with Android, as say a temp solution for my situation?

  • OldRedthOldRedth USMember, Insider ✭✭✭

    @spthomas sorry no, I abandoned binding a long time ago since it was not a fun experience.

  • SeanThomasSeanThomas CAMember

    @Redth No worries, I'll keep playing with ZXing.Mobile and keep an eye out for any changes. Thanks again.

  • bsoulierbsoulier FRMember

    Hi Everyone, I just tried to use ZXing.Net:mobile from the Xamarin components (in v1.3.39 but it keeps on failing with "Error MT2002: Failed to resolve "System.Boolean System.Type::op_Equality(System.Type,System.Type)" reference from "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" (MT2002)"

    I saw that pointers are talking to use 1.3.2 instead, but seems only latest version is available from components...

  • JonathanPryorJonathanPryor USXamarin Team Xamurai

    @bsoulier: Looks like you're trying to use an assembly compiled against the Xamarin.iOS beta in an app using the stable Xamarin.iOS release. The Type.op_Equality() method is not present in the stable releases. It is present in the beta releases and in .NET 4.0.

  • bsoulierbsoulier FRMember
    edited May 2013

    Hi Jonathan,

    Many thanks for the info.
    This brings to me 2 small questions :

    • how stable is the Xamarin.IOS beta channel for me to use for building apps? Can I "downgrade" from beta to release?
    • Does an available component in the Xamarin Components library can make use of Beta versions of Xamarin stack? There is no mention of this requirement over a component details page.

    Perhaps it would be a good idea to add channel version aware components :)

  • mayankguptamayankgupta INMember

    HI @Redth, thanks for the great project.
    One question - I am trying to embed the live camera feed in my own view - Basically i want a live camera feed within a sub view (ie a ImagePicker) on my View. Also, i do not want it to get full screen. Is it possible to customize it this way?
    (I am using it on Xamarin.iOS)
    Thanks!

  • mayankguptamayankgupta INMember

    @Redth thanks much! That helped.

  • OldRedthOldRedth USMember, Insider ✭✭✭

    @Stev page cannot be found :s

  • KevinFanKevinFan CAMember, University

    Thanks for sharing!

  • ChrisMillerChrisMiller USBeta, Developer Group Leader ✭✭

    @Redth,

    Were you able to track down the GC issue? I've noticed with the 1.3.4 code base, that the first few calls to Scan() work fine, then randomly the next call just kills the app dead. This is with the stable channel code and SGen not enabled.

    thanks,
    Chris

  • OldRedthOldRedth USMember, Insider ✭✭✭

    @anotherlab the GC issue was SGEN related in the alpha/beta's .... It should be fixed now (as of 4.7.something) it's been fixed for a little while.

    Need a bit more info on the crashes happening on stable though :s...

  • ChrisMillerChrisMiller USBeta, Developer Group Leader ✭✭

    @Redth, I switched over to the Alpha and enabled SGEN, not seeing the problem that I was on stable. Which is odd, but I'll take it. If I can reproduce it, I'll send you a log.

  • MattVMattV BEMember

    Just tested this product and the scanning is great.
    I do have a problem after the scanning to display a ModalView.

    I'm trying something like this:

    `
               var scanner = new ZXing.Mobile.MobileBarcodeScanner();           
            scanner.Scan().ContinueWith(t => {   
            if (t.Result != null){
                         //create a modal view
                 Controller.PresentViewController (modal, false, null);                                                  
                     } 
    
            }
        }, TaskScheduler.FromCurrentSynchronizationContext());
    

    I'm getting following error:

    Warning: Attempt to present ... while a presentation is in progress!

    I know that when I'm presenting my own Modal Views, I can wait until the previous is dismissed by presenting my new Modal View in the dismissed completion Action from the previous modal view controller.

    But now when using this third party library, I don't know how can I can solve this issue.

    Any ideas?

  • OldRedthOldRedth USMember, Insider ✭✭✭

    @MattV looks like I need to make some changes to wait for the Dismissal of the view controller before returning the scan result.

    If you look at this file: https://github.com/Redth/ZXing.Net.Mobile/blob/master/src/ZXing.Net.Mobile/MonoTouch/MobileBarcodeScanner.cs#L53-L53

    You will notice I do not provide a callback to DismissViewController. I think the best way to solve this is for me to move the scanResultResetEvent.Set(); to be inside the callback for dismissing the view controller.

    I have created an issue for this: https://github.com/Redth/ZXing.Net.Mobile/issues/46 It should be fixed in github soon but it won't make the component store for some time, so you'll need to get the source code and use it when the change is made.

    Thanks for pointing this out!

  • MattV1MattV1 BEMember

    Wauw, thanks for the fast reply!

    I'll keep on eye on your Github page (I'm currently already using the code directly from Github)

  • OldRedthOldRedth USMember, Insider ✭✭✭

    @MattV1 please try the latest code from master... this should work for you now..

  • WeiHoeWeiHoe MYMember

    @Redth,

    May I know continuously scanning for barcode is possible upon clicking a button?

  • MarkEntnerMarkEntner USMember, University

    @Redth,

    This is a great tool! The only issue I've seen is when I scan multiple times the amount of memory keeps increasing. It seems to keep taking longer to display the scanner. I'm using the sample code from the readme.md. I'm currently using it on ios. Thanks for all your great work!

    buttonScan.TouchUpInside += (sender, e) => {

    //NOTE: On Android, you MUST pass a Context into the Constructor!
    var scanner = new ZXing.Mobile.MobileBarcodeScanner();

    var result = await scanner.Scan();

    if (result != null)
    Console.WriteLine("Scanned Barcode: " + result.Text);
    

    };

  • DavidLandinoDavidLandino USMember
    edited November 2013

    First off, thanks so much for your efforts on this project. It is proving invaluable for many users!

    With that said, I am a bit confused and am hoping you can help clarify a few things for me.

    I downloaded and integrated the latest ZXing.Net.Mobile component from the Xamarin store which (I think) is v1.4.0. I am testing the option of using Apple's AVCaptureSession (iOS7 Built in) Barcode Scanning by calling 'scanner.Scan(options, true);' It works great except after 4-5 scans, it takes a long time to load the scanner and eventually crashes.

    After some research, I found a posting on GitHub (https://github.com/Redth/ZXing.Net.Mobile/commit/3f4267e6710dba4c6d4934cac2bddbe613807243) that fix #71 was applied for this issue.

    At that point I removed the Xamarin component from my project and went and downloaded what I thought was the latest source code for the project from https://github.com/Redth/ZXing.Net.Mobile/tree/3f4267e6710dba4c6d4934cac2bddbe613807243 to integrate it directly into my project.

    I assumed this version of the source code included fix #71. However, on that page, the latest version documented is 1.3.6. When I attempt to call 'scanner.Scan(options, true);' I get an error: No overload method for 'scan' takes 2 arguments. This leads me to believe it is an older version I am working with.

    Question(s): What am I missing? Where can I find the latest source for v1.4.0 with issue #71 fixed?

    Thank you in advance for your time on this.


    UPDATE: After another cup of coffee, I was able to locate and find v1.4.0 with the fix for issue #71. Bad news is, my scanner still locks up and crashes after 4-5 consecutive scans. Any thoughts on this? Running iOS 7.0.2

Sign In or Register to comment.