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 Capacitor and other related tools and dependencies.
A project with minimum iOS deployment target of 11.0 or higher. Or an Android project with target SDK version 23 (Android 6, Marshmallow) or higher.
A valid Scandit Data Capture SDK license key. You can sign up for a free test account at ssl.scandit.com.
Note
Android devices running the Scandit Data Capture SDK need to have a GPU or the performance will drastically decrease.
Get a License Key
If you have a paid subscription, please reach out to support@scandit.com if you need a new license key.
Add the SDK
Currently we support adding the Scandit Data Capture SDK Capacitor plugins to your project in two ways. The simplest way is to use the npm registry, alternatively you can manually download the plugins and add them to your project.
Note
You should always make sure to add the scandit-capacitor-datacapture-core plugin, as all other plugins depend on it.
1. Create a new project (optional)
If you do not have a Capacitor project yet that you’ll use, you should create a new one.
> npx cap init
> npx cap add ios
> npx cap add android
2a. Add the Scandit Data Capture SDK from the npm registry
To add our plugins from the npm registry, you can run these commands from your project’s root folder. In the following snippet we’re adding ScanditBarcodeCapture API
yarn add scandit-capacitor-datacapture-core
yarn add scandit-capacitor-datacapture-barcode
Note
You can also specify a version @<version>.
2b. Add the Scandit Data Capture SDK manually
After you download the archive containing all the plugins at ssl.scandit.com/dashboard/downloads, unzip the archive. It includes the available Capacitor plugins, including the scandit-capacitor-datacapture-core plugin that all other plugins depend on.
First add scandit-capacitor-datacapture-core plugin:
yarn add <path to scandit-capacitor-datacapture-core plugin>
Once this is done, you can continue with adding the plugin for your desired functionality, e.g. for barcode capture, add the scandit-capacitor-datacapture-barcode plugin:
yarn add <path to scandit-capacitor-datacapture-barcode plugin>
3. Update the project
After adding the plugins, you’ll want to make sure they’re added to your project properly:
# iOS
> npx cap sync
# Android
> npx cap update android
> npx cap sync
Additional Information
Note
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.
When using the Scandit Data Capture SDK you will want to set the camera as the frame source for various capture modes. The camera permissions are handled by the plugins, so you don’t need to specify anything explicitly.
Next steps
To add single barcode scanning to your app:
Get started with Barcode Capture, the fully-flexible API for single scanning.
Get started with Barcode Selection, our pre-built solution for selection of one of many codes.
To add ID scanning to your app:
To add multi-barcode scanning to your app:
Get started with MatrixScan Count for batch scanning and counting.
Get started with MatrixScan, our fully flexible API for multi-code scanning.