Run Scandit Barcode Scanner Samples in Android Studio

This guide shows you how to run the the sample applications included in the Scandit Barcode Scanner SDK. It is assumed that you have a recent version of Android studio installed on your development machine. These instructions do not work IntelliJ or other IDEs.

To build and run the Scandit demo project, perform the following four steps.

The Scandit Barcode Scanner SDK comes with three demos:

  • A simple demo (SimpleSample) that shows how to use the barcode scanner in a stand-alone activity.
  • An extended sample (ExtendedSample) that allows you to configure the barcode scanner as well as the UI from the application itself.
  • An application that shows how to implement batch mode scanning (BatchModeScanSample).
  • An application that shows how to use MatrixScan (MatrixScanSample).

Get the Scandit Barcode Scanner SDK

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


Open demo project in Android Studio

Unpack the downloaded ZIP file. In Android Studio, select “File” → “Open..”. Select the Samples folder contained in the ZIP file and click "OK".

Set License key

You will have to set your license key in the sample projects. Sign in to your account at http://account.scandit.com to look up your license key in the License Key section.

As an example, in the SimpleSampleActivity.java file, locate the sScanditSdkAppKey constant and paste your license key. 

// Enter your Scandit SDK License key here.
// Your Scandit SDK Liocense key is available via your Scandit SDK web account.
public static final String sScanditSdkAppKey = "-- ENTER YOUR SCANDIT LICENSE KEY HERE --";
private final int CAMERA_PERMISSION_REQUEST = 0;
// The main object for recognizing and displaying barcodes.
private BarcodePicker mBarcodePicker;
private boolean mDeniedCameraAccess = false;
private boolean mPaused = true;
private Toast mToast = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ScanditLicense.setAppKey(sScanditSdkAppKey);
// Initialize and start the bar code recognition.
initializeAndStartBarcodeScanning();
}

Locate the sScanditSdkAppKey constant for the project you want to run:

  • For SimpleSample, the sScanditSdkAppKey is located in SimpleSampleActivity
  • For the ExtendedSample, the sScanditSdkAppKey is located in SampleFulLScreenBarcodeActivity
  • For the BatchModeScanSample, sScanditSdkAppKey is located in SampleAimAndScanBarcodeActivity
  • For the MatrixScanSample, sScanditSdkAppKey is located in MatrixScanSampleActivity

Build and run

You can now build and run the demo project on your Android device.

Next steps

Integrate the Scandit Barcode Scanner SDK into your app