Converting from RedLaser to the Scandit Barcode Scanner

This is the full guide to completely convert from RedLaser to the Scandit Barcode Scanner. The alternative is to use a wrapper around the Scandit Scanner which only provides a limited set of features while a full conversion allows you to use all of the Scanner's features.

Adding the Scandit Barcode Scanner library

Get the ScanditBarcodeScanner

Choose a plan (e.g., free “Enterprise” or "Community" plan) at 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.

Updating from RedLaser's BarcodeScanActivity to a Scandit Activity

Inherit from a normal Activity

Instead of inheriting from the BarcodeScanActivity inherit from a basic Android Activity and tell it to implement the OnScanListener which we will later use to handle the callbacks. Import the necessary interface by pressing ALT + ENTER.

public class YourActivity extends Activity
implements OnScanListener {

Create the BarcodePicker and enable symbologies

In the Activity's onCreate function you will have to create the BarcodePicker and enable the symbologies which you have set on the BarcodeTypes object so far. For this you instantiate BarcodePicker and specify the listener that will receive the callback events. Do not forget to replace #LicenseKey## with your License key, which is available from your Scandit account at (under the "License Keys" section).

Therefore your old code that looks something like this:

public void onCreate(Bundle savedInstanceState) {
// Enabling the symbologies
// other initialization


public void onCreate(Bundle savedInstanceState) {
// Set the license key.
// Create the scan settings and enable the symbologies that you want to scan.
ScanSettings settings = ScanSettings.create();
settings.setSymbologyEnabled(Barcode.SYMBOLOGY_UPCE, true);
settings.setSymbologyEnabled(Barcode.SYMBOLOGY_EAN8, true);
// Instantiate the picker by providing the settings.
BarcodePicker picker = new BarcodePicker(this, settings);
// Specify the object that will receive the callback events
// Add the picker as the root view.
// other initialization

Import the necessary interface by pressing ALT + ENTER.

Starting and stopping the picker

Since Android's camera object is a singleton that has to be released every time your application goes into the background, you have to couple BarcodePicker.startScanning() and BarcodePicker.stopScanning() to the Activity's lifecycle events. Specifically you should start scanning in onResume() and stop scanning in onPause() as follows:

protected void onPause() {
// When the activity is in the background immediately stop the
// scanning to save resources and free the camera.
protected void onResume() {
// Once the activity is in the foreground again, restart scanning.

Changing the callback function

You already specified that the Activity should implement the OnScanListener . You can now remove the old callback function:

protected void onScanStatusUpdate(Map<String, Object> scanStatus) {
Set<BarcodeResult> allResults = (Set<BarcodeResult>) scanStatus.get(Status.STATUS_FOUND_BARCODES);
if (allResults != null && allResults.size() > 0) {
// Your code.

And replace it with the OnScanListener callback function:

public void didScan(ScanSession session) {
if (session.getNewlyRecognizedCodes().size() > 0) {
Barcode code = session.getNewlyRecognizedCodes().get(0);
Log.e("ScanditSDK", "code: " + code.getData() + " of symbology: " + code.getSymbologyName());
// Your code.

Careful: This callback function is called in a background thread and not the main thread. Because of this you need to make sure that you execute things like UI changes specifically in the main thread by using a Handler. A handler for a UI change would look like this:

private static final int UI_UPDATE = 1;
private Handler mHandler = new Handler(Looper.getMainLooper()) {
public void handleMessage(Message msg) {
switch (msg.what) {
Barcode code = (Barcode)msg.obj;
// Update the UI.

Which is called from within OnScanListener.didScan(ScanSession) through:

mHandler.sendMessage(mHandler.obtainMessage(UI_UPDATE, code));

Other functionality


Instead of calling the doneScanning() function you simply call BarcodePicker.stopScanning() and closed the Activity by calling its finish() function.


To specify whether the front or back camera should be opened you can use ScanSettings.setCameraFacingPreference(int) .


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.


To restrict the area within which the scanner looks for barcodes you can use ScanSettings.setActiveScanningArea(int, RectF) . Be aware that setting the active scanning area does not change the UI. If you would like to adjust the viewfinder to match the new scanning area you should use ScanOverlay.setViewfinderDimension(float, float, float, float) .


To access one or more frames captured by the camera you set a ProcessFrameListener through BarcodePicker.setProcessFrameListener(ProcessFrameListener) and implement the callback function didProcess(byte[] imageBuffer, int width, int height, ScanSession session) where you will receive the processed frame.

getTorch() and isTorchAvailable

The Scandit Barcode Scanner does not contain any equivalent functions to these.