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
For barcode scanner usage examples, you can either use one of the sample apps included in the plugin archive, or paste one of the samples below into your www/index.html file.
Build the sample apps
In order to build the simple or extended sample apps you must import one of them upon creation of your project as follows.
Note that you will still need to add the platform and plugin as described in here. You will also need to replace the app key in the samples with your application key.
Simple sample
Extended sample
For the extended sample, the application key is in <path-to-repository>/samples/extended/src/providers/scanner.ts
, in the setAppKey
method. After setting the application key, running npm run build
is necessary for the build files in the www
folder to be updated — the recommendation is to add the app key before running the commands below.
Note that the --link-to
option will symlink to the specified www directory without creating a copy. For more information, see https://cordova.apache.org/docs/en/latest/reference/cordova-cli/#cordova-create-command.
Simple Fullscreen
This shows the simplest way of using the plugin. The scanner is opened full screen and is closed as soon as a barcode is scanned, returning the result to a function specified by you.
Continuous Scaled/Cropped
For an example of how to display the picker in a scaled/cropped configuration, take a look at the extended sample which is part of the SDK archive.