CN1Lib for using ZBar scanning in Android apps.
Java Objective-C C#
Latest commit 4e3c6d0 Aug 28, 2016 @DigNZ DigNZ committed on GitHub Merge pull request #4 from shannah/master
Added android.xapplication to appended properties.
Permalink
Failed to load latest commit information.
bin Added android.xapplication to appended properties. Aug 26, 2016
lib
native updated to support gradle and newer codename one versions Jun 21, 2016
nbproject Changed to use the cn1-codescan library instead of the deprecated com… Aug 22, 2016
src/org/littlemonkey/qrscanner Changed to use the cn1-codescan library instead of the deprecated com… Aug 22, 2016
.gitignore converted ZBar lib from andlib to aar file Mar 14, 2016
LICENSE Update LICENSE Jul 10, 2014
README.md Added built cn1-lib file to bin directory to make it easier. Aug 22, 2016
Stubber.jar Initial Commit with QR scanning working. CAM-6, CAM-4 Apr 29, 2014
build.xml Changed to use the cn1-codescan library instead of the deprecated com… Aug 22, 2016
codenameone_library.properties updated to support gradle and newer codename one versions Jun 21, 2016
codenameone_library_appended.properties Added android.xapplication to appended properties. Aug 26, 2016
codenameone_library_required.properties Changed to use the cn1-codescan library instead of the deprecated com… Aug 22, 2016
manifest.mf Initial Commit with QR scanning working. CAM-6, CAM-4 Apr 29, 2014
manifest.properties Initial Commit with QR scanning working. CAM-6, CAM-4 Apr 29, 2014

README.md

QRScanner

CN1Lib for using ZBar scanning in Android apps.

The built in Codename One implementation of CodeScanner works well on iOS but has some issues on Android.
This module works around those issues by embedding ZBar into the Android build.

This removes the reliance on an external scanning app to be installed and seems to scan faster.

It does add several megabytes to the final .apk file size.

How to use

Installation

  1. Install the cn1-codescan library into your project.
  2. Build or download the QRScanner.cn1lib file.
  3. Put the file the libs folder of your project.
  4. Right-click on your project and choose Refresh Libs

Example Code

Basically use QRScanner instead of CodeScanner.

QRScanner.scanQRCode(new ScanResult() {
    public void scanCompleted(String contents, String formatName, byte[] rawBytes) {
        Dialog.show("Completed", contents, "OK", null);
    }
    public void scanCanceled() {
        Dialog.show("Cancelled", "Scan Cancelled", "OK", null);
    }
    public void scanError(int errorCode, String message) {
        Dialog.show("Error", message, "OK", null);
    }
});

Converting an existing app

It should pretty much be a drop in replacement for CodeScanner. If you need to detect if code scanning is supported on the current platform then you need to keep the original check do not change this line to QRScanner:

if (CodeScanner.getInstance() != null) {
    QRScanner.scanQRCode(myScanResult);
} else {
    Dialog.show("Not Supported","QR Code Scanning is not available on this device","OK",null);
}