Converting from RedLaser to the Scandit RedLaser Wrapper

Making use of the RedLaser wrapper is the fastest way of converting an app using the RedLaser Scanner to the Scandit Barcode Scanner library. The wrapper emulates the classes you know from the RedLaser library and maps its functionality onto the Scandit Barcode Scanner. As the libraries do not have the exact same functionality not all functions can be mapped.

Removing the RedLaser SDK

Remove the RedLaser library and resources from your project. Do not change your own classes that make use of the library.

Adding the Scandit Barcode Scanner library to your Android app

Get the ScanditBarcodeScanner

Choose a plan (e.g., free “Enterprise” or "Community" plan) at http://www.scandit.com/pricing and download the Scandit Barcode Scanner SDK for Android from your account.

Download page


Add the libraries to your project

  1. Copy libs folder

    The ZIP file you downloaded contains a folder named libs (ScanditSDK/libs). Create in your Android Studio project the folder jniLibs (at this location /app/src/main/) and copy the content of the lib folder in it.

  2. Copy the raw folder

    Copy the raw folder located inside the res folder to the res folder of your Android Studio project.

  3. Add jar

    Add the scanditsdk–android-x.x.x.jar, which is contained in the jniLibs folder, to Dependencies (right click → "Open Module Settings" →"Dependencies", add "File dependency").


Project Setup


Project tree:


Project Setup


Change minimum SDK version

Starting with Scandit 4.0.0 the required Android version is 2.3. If the android:minSdkVersion in your manifest is below 9, change it to 9.

Making use of the RedLaser wrapper

Add the wrapper classes

Download the RedLaser Wrapper for Android and unpack the zip file containing the wrapper classes. Add them to your Android project, making sure that the package stays the same (com.ebay.redlasersdk).

Setting the License Key

Instead of the license xml of RedLaser you have to implement an abstract function that we added to the wrapper's BarcodeScanActivity which looks as follows. The license key is available from your Scandit SDK account at http://account.scandit.com (under the "Licenses Keys" section).

@Override
protected String scanditAppKey() {
return "##LicenseKey##";
}

You're done

The wrapper takes care of everything else! You are already done!

Unsupported functions

As touched on previously not all functions can be directly mapped from one library to the other. This section lists the functions of the RedLaser scanner that are not mapped to the Scandit Barcode Scanner. Most of the functionality covered by these functions exist in the Scandit Barcode Scanner but is available in a way that does not allow for a one-to-one mapping. If you want to make use of functionality like this anyway you will have to properly convert to using the Scandit Barcode Scanner instead of the wrapper. Check out Converting from RedLaser to the Scandit Barcode Scanner for this.

getOrientationSetting()

The Scandit Barcode Scanner automatically adjusts itself depending on the device orientation. If you want to force the Activity to a certain orientation you should specify this in the Manifest.xml or use Activity specific functions to change it.

requestCameraIndex(int)

Can't be directly mapped onto an existing function.

setActiveRect(Rect)

Can't be directly mapped onto an existing function.

requestImageData()

Can't be directly mapped onto an existing function.

getTorch() and isTorchAvailable

An equivalent function does not exist.