问题
I'm using the zxing (http://code.google.com/p/zxing/) library for doing qr code reading on Android and iOS. It works great for reading the first qr code, however then it runs into issues.
An easy way to reproduce is to read a qr code, and then place another qr code in front of the device. The scanner will not read the new qr code. After moving the device so that the qr code is completely off the screen, then moving the device to refocus on the qr code, it will read it successfully.
Is there some autofocus setting in zxing that I can tinker with? Or is there a way to "reset" the scanner after reading the first code so that it will be ready to read the second code?
I should also mention that I'm using zxing as a module within Titanium.
回答1:
I think it's camera permission issue, have you give auto focus permission and other permissions?
Like:
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera.autofocus"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.FLASHLIGHT"/>
And if you still get an error then try with adding more permissions as listed below:
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.front"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.flash"
android:required="false" />
<uses-feature android:name="android.hardware.screen.landscape" />
<uses-feature
android:name="android.hardware.wifi"
android:required="false" />
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
<uses-feature android:name="android.hardware.camera" />
来源:https://stackoverflow.com/questions/14126045/zxing-barcode-scanner-autofocus-issue-on-reading-second-qr-code