Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 892
Twomz Avatar asked Jan 14 '12 15:01

Twomz


People also ask

Can iPhones use barcode scanners?

Open the Camera app from the Home Screen, Control Center, or Lock Screen. Select the rear facing camera. Hold your device so that the QR code appears in the viewfinder in the Camera app. Your device recognizes the QR code and shows a notification.


1 Answers

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.

like image 83
Nicolas Lehuen Avatar answered Sep 28 '22 14:09

Nicolas Lehuen