You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 4
Next »
There are several ways in incorporate barcode / QR codes into the BMP via Blink's native app shells.
This can be done by calling the cordova plugin (barcodereader)
/*
* Custom code for reading Barcodes into a form field (native apps only).
* To be added as manual calculation code for Calculation fields.
*
* NB: Javascript line comments should *NOT* be used in custom code added to forms.
*/
function() {
var barcodereader = window.cordova.require(
'cordova/plugin/BGBarcodeReader'),
bfo = this;
/*
* Function to be called after successfully reading a barcode.
*/
var onSuccess = function(message) {
bfo.setFieldValue("BarcodeValue", message);
/* Please replace 'BarcodeValue' with the name of the target field
in the form. */
bfo.setFieldValue("readBarcode", "");
/* Please replace 'readBarCode' with the name of the Calculation
field where the custom code will be inserted. */
console.log(message);
};
/*
* Function to be called after an error.
*/
var onError = function(message) {
console.log(message);
navigator.notification.alert(message);
};
barcodereader.getBarcode(onSuccess, onError, []);
return 'Scanning...';
}