Skip to main content

Using Phonegap Barcode Scanner on Iphone



I'm trying to add a barcode scanner to a JQM phonegap project for iOS. I have followed the instructions listed, although I'm not 100% sure if I did the first and last steps correctly.







Copy the .h, .cpp and .mm files to the Plugins directory in your project. You may need to set the compile options for zxing-all-in-one.cc to turn off optimization.







I directly copied the three files into the plugins folder in xcode. It isn't giving me any errors, but it also isn't working. I have no idea how to do compiler options in xcode, so I haven't done the last step.





Currently my app still runs with no errors and running the scan function opens the camera with the ui for the barcode scanner up. The problem is that it doesn't seem to be either looking for or finding barcodes, it just stays up and does nothing (until you hit cancel, then it displays the cancelled message correctly).





Anyone have any ideas what's wrong or where I should look?


Comments

  1. If the camera is turned on and the UI for scanning appears on the screen, then it means you've done everything right. The problem seems to be that the scanner doesn't detect the barcodes.

    Be aware that recognizing 1D barcodes ("classical" barcodes) with zxing require an iPhone with autofocus lens (iPhone 4 or iPhone 4S). 1D barcodes are a little tricky to detect with mobile phone lenses, you need proper light and focus ; that's one reason why 2D codes like QR code where invented.

    Try generating a QR code with http://zxing.appspot.com/generator/, display it on the screen and try scanning it with your app. If it works then good news, everything is OK, but bad news, your phone is not fit for 1D barcode scanning.

    ReplyDelete

Post a Comment

Popular posts from this blog

[韓日関係] 首相含む大幅な内閣改造の可能性…早ければ来月10日ごろ=韓国

div not scrolling properly with slimScroll plugin

I am using the slimScroll plugin for jQuery by Piotr Rochala Which is a great plugin for nice scrollbars on most browsers but I am stuck because I am using it for a chat box and whenever the user appends new text to the boxit does scroll using the .scrollTop() method however the plugin's scrollbar doesnt scroll with it and when the user wants to look though the chat history it will start scrolling from near the top. I have made a quick demo of my situation http://jsfiddle.net/DY9CT/2/ Does anyone know how to solve this problem?

Why does this javascript based printing cause Safari to refresh the page?

The page I am working on has a javascript function executed to print parts of the page. For some reason, printing in Safari, causes the window to somehow update. I say somehow, because it does not really refresh as in reload the page, but rather it starts the "rendering" of the page from start, i.e. scroll to top, flash animations start from 0, and so forth. The effect is reproduced by this fiddle: http://jsfiddle.net/fYmnB/ Clicking the print button and finishing or cancelling a print in Safari causes the screen to "go white" for a sec, which in my real website manifests itself as something "like" a reload. While running print button with, let's say, Firefox, just opens and closes the print dialogue without affecting the fiddle page in any way. Is there something with my way of calling the browsers print method that causes this, or how can it be explained - and preferably, avoided? P.S.: On my real site the same occurs with Chrome. In the ex