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 GoNative 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);
}
↔️GoNative JavaScript Bridge
To initiate a scan, open the url:
// returns promise gonative.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.
↔️GoNative JavaScript Bridge
For example, to only scan qr and pdf417 codes, initiate a scan by opening the url:
// returns promise gonative.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 yourgonative.scanditBarcode
call.For example:
// returns promise gonative.scanditBarcode.scan({'callback': scandit_result, 'symbologies': 'qr, code128', 'parser': 'dlid'});
Updated 11 months ago