Since the recent update for Codename one any barcode scanning seems to be broken.
On android the camera appears and scans the code but nothing happens when it returns to the app (that is none of the 3 callback functions are triggered).
On iOS the camera window doesn't even appear.
I'm using this library since it doesn't rely on an installed scanning app:
https://github.com/littlemonkeyltd/QRScanner
I had thought the inbuilt scanning functionality may have been removed and passed to this library, so I tried to include that too:
https://github.com/codenameone/cn1-codescan
However it still isn't working on Android. IOS refuses to build with the cn1-codescan library included.
Pretty sure this was all working last week, or the week before.
my code looks like this:
Log.p("Scanning QR code");
QRScanner.scanQRCode(new ScanResult() {
public void scanCompleted(String contents, String formatName, byte[] rawBytes) {
Log.p("QR result:"+contents);
QRResult(contents, formatName, rawBytes);
}
public void scanCanceled() {
Log.p("scan canceled");
}
public void scanError(int errorCode, String message) {
Log.p("error during scan: " + message);
scanFailed();
}
});
edit:
Here are the android build hints added to codenameone_setting.properties when I add the libraries in:
codename1.arg.android.xapplication=<activity android\:name\="com.dm.zbar.android.scanner.ZBarScannerActivity" android\:screenOrientation\="landscape" android\:label\="@string/app_name" />
codename1.arg.android.xpermissions=<uses-permission android\:name\="android.permission.CAMERA"/><uses-feature android\:name\="android.hardware.camera" android\:required\="false"/>
codename1.arg.android.proguardKeep=\ -keep class net.sourceforge.zbar.** {*;}
If you build against the "latest" barcode scanning should work. I'm assuming that you built against 3.5 and not the latest. It's possible that the regression in barcode scanning got into 3.5, this we verified that barcode/qr code scanning works with the latest on the build servers.