Detect if a Barcode Scanner
(or external keyboard) is connected to iOS device
You need to have Cordova Keyboard Plugin, in order to use this package.
npm i cordova-plugin-keyboard
npm i barcode-scanner-status
import brcScannerStatus from "barcode-scanner-status";
Add this line in your config.xml in order to enable .focus();
<preference name="KeyboardDisplayRequiresUserAction" value="false" />
Returns scanner status after delay, which by default is 5ms.
brcScannerStatus.checkForScanner().then((scannerConnected) => {
console.log(scannerConnected);
});
Destroy eventListener for scanner status
brcScannerStatus.destroy();