Installation
This page describes how to integrate the Scandit Data Capture SDK into your Android project.
The Scandit Data Capture SDK is distributed as AAR libraries in the official Scandit maven repository.
Prerequisites
Before you begin, make sure you have the following prerequisites in place:
- Latest version of the Android SDK (for example through the latest Android Studio)
- Android project with target SDK version 23 (Android 6, Marshmallow) or higher
- Valid Scandit Data Capture SDK license key
Devices running the Scandit Data Capture SDK need a GPU. Otherwise, you can see a significant decrease in performance.
Internal Dependencies
Some of the Scandit Data Capture SDK modules depend on others to work:
Module | Dependencies | Optional Dependencies |
---|---|---|
ScanditCaptureCore | None | None |
ScanditBarcodeCapture | ScanditCaptureCore | None |
ScanditParser | None | None |
ScanditLabelCapture | ScanditCaptureCore ScanditBarcodeCapture | ScanditLabelCaptureText ScanditPriceLabel |
ScanditIdCapture | ScanditCaptureCore | ScanditIdCaptureBackend ScanditIdEuropeDrivingLicense ScanditIdAamvaBarcodeVerification ScanditIdVoidedDetection |
When using ID Capture or Label Capture, consult the respective module's getting started guides to identify the optional dependencies required for your use case. The modules you need to include will vary based on the features you intend to use.
Please be aware that your license may only cover a subset of Barcode and/or ID Capture features. If you require additional features, contact us.
External Dependencies
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 you directly add the AAR files to the project, you need to add these dependencies yourself.
org.jetbrains.kotlin:kotlin-stdlib:[version]
androidx.annotation:annotation:[version]
com.squareup.okhttp3:okhttp:4.9.2
Install via Package Manager
- Gradle
- Maven
You can add mavenCentral() repository in build.gradle file:
repositories {
mavenCentral()
}
You can 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]"
implementation "com.scandit.datacapture:text-base:[version]"
implementation "com.scandit.datacapture:text:[version]"
implementation "com.scandit.datacapture:id:[version]"
}
You can find the latest version on Sonatype.
You can add the mavenCentral repository in pom.xml file:
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Maven Central</name>
<url>https://repo1.maven.org/maven2</url>
</repository>
</repositories>
You can 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>
<dependency>
<groupId>com.scandit.datacapture</groupId>
<artifactId>text-base</artifactId>
<version>[version]</version>
</dependency>
<dependency>
<groupId>com.scandit.datacapture</groupId>
<artifactId>text</artifactId>
<version>[version]</version>
</dependency>
<dependency>
<groupId>com.scandit.datacapture</groupId>
<artifactId>id</artifactId>
<version>[version]</version>
</dependency>
Install Manually
You 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 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, for instance, as found in barcodes, into a set of key-value mappings
- ScanditIdCapture API if you want to scan personal identification documents, such as identity cards, passports or visas
If your project already has a local flatDir
repository, add the AAR files to that folder. If you do not have a flatDir
repository 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 .aar libraries as dependencies to your build.gradle
file:
dependencies {
api(name:'ScanditBarcodeCapture', ext:'aar')
}
Additional Information
Incompatible Modes Error
If you’re using androidx.fragments dependency and have the situation where a scanning fragment navigates to another scanning fragment with an incompatible mode, make sure you’re using version 1.3.0+ of the dependency.
If not, you may run into an incompatible modes error as the new fragment gets resumed before the previous is paused and for some time incompatible modes may be enabled in the DataCaptureContext
at the same time. This results in sessions being empty of any result.
Content Providers
On Android, the Scandit SDK uses content providers to initialize the scanning capabilities properly. If your own content providers depend on the Scandit SDK, choose an initOrder lower than 10 to make sure the SDK is ready first.
If not specified, initOrder is zero by default and you have nothing to worry about.
Check the official provider documentation.
Third-party Licenses
The Scandit Data Capture SDK relies on several third-party, open-source software libraries. Your application must display the license information for these libraries in many cases.
The Scandit SDK provides a convenient API that you can use to fetch the corresponding text and attributions for all third-party software:
DataCaptureContext.openSourceSoftwareLicenseInfo()