scanner.enable() trhow ScannerException

L Lorenzo berti 3 years 4 months ago
6 0 0

Hello,In my app for Zebra MC330M I use EMDK: Zebra Technologies Corp:EMDK APIs:26

I have a activity that implements listener and I override onOpened function:

@Overridepublic void onOpened(EMDKManager emdkManager) {
    this.emdkManager = emdkManager;    try {
       initializeScanner();     } catch (ScannerException e) {
        Log.e("ON_OPENED", e.getMessage());        e.printStackTrace();     }
}

And as documentation said in Link: Basic Scanning Tutorial using Barcode API - Zebra Technologies Techdocs

I put in the initializeScanner function:
if (scanner == null) {
   // Get the Barcode Manager object   barcodeManager = (BarcodeManager) emdkManager.getInstance(FEATURE_TYPE.BARCODE);   // Add connection listener   if (barcodeManager != null) {
   barcodeManager.addConnectionListener(this);   }
   // Get default scanner defined on the device   scanner = barcodeManager.getDevice(BarcodeManager.DeviceIdentifier.DEFAULT);   // Add data and status listeners   scanner.addDataListener(this);   scanner.addStatusListener(this);   // Hard trigger. When this mode is set, the user has to manually  // press the trigger on the device after issuing the read call.   scanner.triggerType = TriggerType.HARD;   // Enable the scanner   scanner.enable();   startRead = true;   }

But when call scanner.enable() it throws ScannerException exception with message:

"Failure"

CONTACT
Can’t find what you’re looking for?