Deprecation warning

Please note that this is outdated documentation for an older release of the Scandit Barcode Scanner SDK.

We are deprecating the 5.x API on all platforms (except Linux). Release 5.19 in April 2021 will be our final. Applications running 5.x will continue to work, and we will continue to release critical bug fixes and security patches only, for one year. We encourage you to migrate to 6.x and take advantage of our latest / advanced features and improved performance.

You'll find the updated documentation at: Data Capture SDK Documentation for Cordova


enum  State
enum  StateChangeReason

Public Member Functions

void volumeButtonToScanEnabled (boolean enabled)
void scanBeepEnabled (boolean enabled)
void errorSoundEnabled (boolean enabled)
void setTimeout (Number timeout, ScanCase.State fromState, ScanCase.State toState)

Static Public Member Functions

static void acquire (ScanSettings settings, CaseCallbacks callbacks)

Detailed Description

Start a scanner for the Scandit case (iOS only).

Example (minimal) usage:

// Set your app key on the license first.
Scandit.License.setAppKey("-- ENTER YOUR SCANDIT LICENSE KEY HERE --");
// Define the callbacks for scan case life-cycle events.
var callbacks = {
// Called when the scan case is initialized.
didInitialize: function () { },
// Called whenever a code has been scanned.
didScan: function (session) {
// Called whenever the scan case changes state, e.g. when switching from standby to active.
didChangeState: function (data) { console.log(data.state); }
// Acquire exclusive access to the scan case.
scanCase = Scandit.ScanCase.acquire(scanSettings, callbacks);

Class Documentation

enum Scandit::ScanCase::State

Enumerates the possible state for the scan case.

Class Members
ACTIVE Camera is off, torch is off.
OFF Camera is on but with throttled frame-rate, scanner is off, torch is off.
STANDBY Camera is on, scanner is on, torch is on.
enum Scandit::ScanCase::StateChangeReason

Enumerates the possible reasons for which the scan case state has changed.

Class Members
MANUAL The state was changed directly.
TIMEOUT The change of state was driven by a timeout.
VOLUME_BUTTON The change of state was driven by the volume button.

Member Function Documentation

static void acquire ( ScanSettings  settings,
CaseCallbacks  callbacks 

Initializes a new scan case.

Note that the initial invocation of this method will activate the Scandit Barcode Scanner SDK, after which the device will count towards your device limit.

Make sure to set the app key available from your Scandit account through SBSLicense::setAppKey: before you call this initializer.

This is the recommended way to create a new ScanCase object.

settingsThe scan settings to use.
callbacksThe scan case callbacks.
void volumeButtonToScanEnabled ( boolean  enabled)

Turn on/off scanning via the volume button.

Set to true to change the state of the scan case using the volume button (holding the volume button changes the state to ScanCase.State.Active, while releasing it changes the state to ScanCase.State.Standby). Set to false to avoid controlling the state of the scan case via the volume button.

The default value is false.

void scanBeepEnabled ( boolean  enabled)

Whether to play a beep sound upon a successful scan.

By default, a beep sound is played upon successfully scanning a barcode. Set this property to false, to disable the sound. If the ringer mode is set to silent, no beep sound is played, regardless of the value of this property.

void errorSoundEnabled ( boolean  enabled)

Whether to play an error sound when no code was scanned.

By default, an error sound is played when activating the scanner using the volume button control when no could be scanned. If the ringer mode is set to silent, no sound is played, regardless of the value of this property.

void setTimeout ( Number  timeout,
ScanCase.State  fromState,
ScanCase.State  toState 

Set a timeout to automatically change state after a specific interval.

Set a timer that is started whenever the state is changed to fromState. The timer will have a time interval equal to timeout and then it will switch the state of the scan case to toState. The timer will be created every time the state of the scan case is equal to fromState. At any given time there could not be more than one timeout for each fromState.

timeoutThe interval of the timer.
fromStateThe state from which the timer should start.
toStateThe new state when the timer is fired.