Cordova Zebra Scanner Plugin for the built-in barcodes scanner.
npm install cordova-plugin-zebra-scanner-spectrumwindow.plugins.zebra.scanner object which provides an API for interacting with scanner hardware scanner on Zebra devices. deviceready event. document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
console.log(window.plugins.zebra.scanner);
}
This plugin is based on https://github.com/darryncampbell/EnterpriseBarcodePoC by Darryn Campbell
Install
-------
Cordova: cordova plugin add cordova-plugin-zebra-scanner-spectrum
Tested successfully with
------------------------
- Zebra TC21 - Android 10
- Android
Boolean which is true when the EMDK scanner is available on the device.
if (window.plugins.zebra.scanner.available) {
console.log("EMDK is available");
);
Enables the barcode scanner hardware and the associated trigger, __so pressing the hardware trigger will initiate a scan__.
window.plugins.zebra.scanner.startHardRead(enableSuccess, enableFailure);
window.plugins.zebra.scanner.startHardRead(
function (scannedObj) {
console.log("Scan data: " + scannedObj.data);
console.log("Scan symbology: " + scannedObj.type);
console.log("Scan time: " + scannedObj.timestamp);
},
function (status) {
console.log("Scanner failure: " + status.message);
}
);
Enables the barcode scanner hardware and the associated trigger, __it will start scanning immediately without the need of a hardware trigger__.
window.plugins.zebra.scanner.startSoftRead(enableSuccess, enableFailure);
window.plugins.zebra.scanner.startSoftRead(
function (scannedObj) {
console.log("Scan data: " + scannedObj.data);
console.log("Scan symbology: " + scannedObj.type);
console.log("Scan time: " + scannedObj.timestamp);
},
function (status) {
console.log("Scanner failure: " + status.message);
}
);
Stops the currently active scan.
window.plugins.zebra.scanner.stopReading();