How to handle failure cases and scanner timeout callback in zebra using DataWedge in android?

658 views Asked by At

Used DataWedge feature to scan the barcode in zebra device and send it back to device using intent.

I used below code to receive scanned data using intent.

override fun onNewIntent(intent: Intent) {
        super.onNewIntent(intent)
        //  DataWedge intents received here
        if (intent.hasExtra(DWInterface.DATAWEDGE_SCAN_EXTRA_DATA_STRING)) {
            Log.v(tag, "onNewIntent()")
            //  Handle scan intent received from DataWedge
            val barcodeData = intent.getStringExtra(DWInterface.DATAWEDGE_SCAN_EXTRA_DATA_STRING)
            Log.v(tag, "scanData: $barcodeData")
        }
    }

I need to know how to handle scanner failure cases & scanner timeout callback?

1

There are 1 answers

2
Darryn Campbell On

There is not an API to let you know the scan has timed out. The best way to achieve this would probably be to use the Register_For_Notification API and detect when the scanner goes from SCANNING to WAITING, if that transition is not accompanied by a successful scan you can assume the scan timed out or the user released the trigger. I have a sample app showing how to register for the scanner state.