Scandit QR / Barcode
Overview
Scan QR Codes and Barcodes directly into your app via the device camera. This plugin is similar to our basic version with additional functionality provided by Scandit. An active Scandit license is required.
Implementation Guide
Once the premium module has been added to your app, you may use the following Median JavaScript Bridge commands to access its functionality.
To scan a barcode, define a function in JavaScript, for example:
function scandit_result(data) {
console.log('Scanned barcode ' + data.code + ' of type ' + data.type);
}
↔️Median JavaScript Bridge
To initiate a scan, open the URL:
// returns promise median.scanditBarcode.scan({'callback': scandit_result});
Tip: Some JS Bridge commands return promises. They are usually declared as such through a comment to help you identify them. Learn More.
By default, we scan for these symbologies:
- ean13
- upc12
- ean8
- upce
- code39
- code128
- itf
- qr
- datamatrix
- pdf417
If you would like to limit the list, you can add a query parameter with a comma-separated list of symbologies.
↔️Median JavaScript Bridge
For example, to only scan qr and pdf417 codes, initiate a scan by opening the URL:
// returns promise median.scanditBarcode.scan({'callback': scandit_result, 'symbologies': 'qr, pdf417'});
Note: For some symbologies such as code128, you will need to specify a parser to use in parsing the data. For example, you will need to add an extra query parameter,
parser=dlid
to yourmedian.scanditBarcode
call.For example:
// returns promise median.scanditBarcode.scan({'callback': scandit_result, 'symbologies': 'qr, code128', 'parser': 'dlid'});
Updated 9 months ago