Add the SDK to Your App#

This guide shows you how to add the Scandit Data Capture SDK to current existing project.

Prerequisites#

  • The latest stable version of the Android SDK (for example through the latest Android Studio).

  • An Android project with target SDK version 19 (4.4 KitKat) or higher.

  • A valid Scandit Data Capture SDK license key. You can sign up for a free test account at ssl.scandit.com.

Note

Devices running the Scandit Data Capture SDK need to have a GPU or the performance will drastically decrease.

Get a License Key#

  1. If you don’t have a scandit account yet, create a free test account at ssl.scandit.com/customers/new?p=test.

  2. Sign in to your account at ssl.scandit.com/sessions/new.

  3. Select “License Keys” from the left-hand menu

  4. If you don’t have a license key for your app yet, click “Create native SDK license key” and enter the bundle ID for your project.

  5. Copy the license key.

Should you have a paid subscription, please reach out to support@scandit.com if you need a new license key.

Add the SDK#

Scandit Data Capture SDK is distributed as AAR libraries in the official Scandit maven repository.

You will always need to add a reference to com.scandit.datacapture:core, which contains the shared functionality used by the other data capture modules. In addition, depending on the data capture task, you will need a reference to:

  • com.scandit.datacapture:barcode (ScanditBarcodeCapture API) if you want to use barcode-related functionality such as barcode capture or MatrixScan.

  • com.scandit.datacapture:parser (ScanditParser API) if you want to parse data strings, e.g. as found in barcodes, into a set of key-value mappings.

You can safely remove barcode or parser dependencies if you are not going to use their features.

Gradle#

Add jcenter repository in build.gradle file:

repositories {
  jcenter()
}

Alternatively, you can just add a link to the official Scandit maven repository on jcenter:

repositories {
  maven { url 'https://scandit.bintray.com/DataCapture' }
}

Add the necessary artifacts as dependencies to the app’s build.gradle:

dependencies {
  implementation "com.scandit.datacapture:core:[version]"
  implementation "com.scandit.datacapture:barcode:[version]"
  implementation "com.scandit.datacapture:parser:[version]"
}

Latest [version] is 6.1.2 and can be found on Bintray.

Maven#

Add the jcenter repository in pom.xml file:

<repositories>
  <repository>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>central</id>
      <name>bintray</name>
      <url>http://jcenter.bintray.com</url>
  </repository>
</repositories>

If you prefer to only add the official Scandit jcenter repo, provide the following config instead:

<repositories>
  <repository>
    <snapshots>
      <enabled>false</enabled>
    </snapshots>
    <id>bintray-scandit-DataCapture</id>
    <name>bintray</name>
    <url>https://scandit.bintray.com/DataCapture</url>
  </repository>
</repositories>

Add the necessary artifacts as dependencies:

<dependency>
  <groupId>com.scandit.datacapture</groupId>
  <artifactId>core</artifactId>
  <version>[version]</version>
</dependency>

<dependency>
  <groupId>com.scandit.datacapture</groupId>
  <artifactId>barcode</artifactId>
  <version>[version]</version>
</dependency>

<dependency>
  <groupId>com.scandit.datacapture</groupId>
  <artifactId>parser</artifactId>
  <version>[version]</version>
</dependency>

Latest [version] can be found here.

Manually Add the Library to your Project#

You will always need to add a reference to ScanditCaptureCore.aar, which contains the shared functionality used by the other data capture modules. In addition, depending on the data capture task, you will need a reference to:

  • ScanditBarcodeCapture API if you want to use barcode-related functionality such as barcode capture or MatrixScan.

  • ScanditParser API if you want to parse data strings, e.g. as found in barcodes, into a set of key-value mappings.

If your project already has a local flatDir repository, add the AAR files to that folder. If you do not have a flatDir respository yet, create a new one in your build.gradle file as illustrated below:

repositories {
  flatDir {
    dirs '/path/to/folder/containing/the/aar/file'
  }
}

Add the ScanditBarcodeScanner as a dependency to your build.gradle file:

dependencies {
  api(name:'ScanditBarcodeScanner', ext:'aar')
}

Dependent libraries#

The Scandit Data Capture SDK modules depend on a few standard libraries that you can find listed below. If you are including the Scandit Data Capture SDK through Gradle or Maven, all of these dependencies are automatically pulled in and there is no need for you to do anything further. If on the other hand you are directly adding the AAR files to the project, you will have to add these dependencies yourself.

  • ScanditCaptureCore.aar depends on:

    • org.jetbrains.kotlin:kotlin-stdlib:[version],

    • org.jetbrains.kotlin:kotlin-reflect:[version],

    • androidx.annotation:annotation:[version].

  • ScanditBarcodeCore.aar depends on:

    • org.jetbrains.kotlin:kotlin-stdlib:[version],

    • org.jetbrains.kotlin:kotlin-reflect:[version].

  • ScanditParser.aar depends on:

    • org.jetbrains.kotlin:kotlin-stdlib:[version],

    • org.jetbrains.kotlin:kotlin-reflect:[version],

    • androidx.appcompat:appcompat:[version].

Create a Test License Key#

  1. Sign in to your account at ssl.scandit.com/sessions/new.

  2. Select “License Keys” from the left-hand menu

  3. Click “Create native SDK license key” and enter the bundle ID for your project.

Should you have a paid subscription, please reach out to support@scandit.com if you need a new license key.

Additional Information#

  • When using the Scandit Data Capture SDK you will want to set the camera as the frame source for barcode, text and label capture. Thanks to the manifest merge feature android.permission.CAMERA permission is added to your final AndroidManifest.xml. You don’t need to add it explicitly.

  • The Scandit Data Capture SDK might not work correctly when you use ProGuard. To avoid issues, add the following line to the proguard configuration:

-keep class com.scandit.datacapture.** { *; }

Next steps#

You are now ready to tackle the following guides: