scanner.enable() throws ScannerException

K Kerry Wei 3 years 6 months ago
68 1 0

My app sometimes (yes, sometimes) get the following exception when trying to init the Motorola TC55 scanner:
 
10-23 20:18:54.237    1895-1895/com.amazon.yms.mobile.tasks W/System.err﹕ Throwable occurred: com.symbol.emdk.barcode.ScannerException: Failure 10-23 20:18:54.237    1895-1895/com.amazon.yms.mobile.tasks W/System.err﹕ at com.symbol.emdk.barcode.Scanner.enable(Scanner.java:352) 10-23 20:18:54.237    1895-1895/com.amazon.yms.mobile.tasks W/System.err﹕ at com.amazon.yms.mobile.tasks.EMDKScannerWrapper.initMotorolaScanner(EMDKScannerWrapper.java:143) 10-23 20:18:54.237    1895-1895/com.amazon.yms.mobile.tasks W/System.err﹕ at com.amazon.yms.mobile.tasks.EMDKScannerWrapper.onOpened(EMDKScannerWrapper.java:261) 10-23 20:18:54.237    1895-1895/com.amazon.yms.mobile.tasks W/System.err﹕ at com.symbol.emdk.EMDKServiceConnection.notifyonConnected(EMDKServiceConnection.java:112) 10-23 20:18:54.237    1895-1895/com.amazon.yms.mobile.tasks W/System.err﹕ at com.symbol.emdk.EMDKServiceConnection.onServiceConnected(EMDKServiceConnection.java:92) 
 
I perform all the initialization work suggested by the tutorial in the onResume() method, and de-init the scanner and release the resources in onPause() method. Once the work at current activity is finished, I start a new activity (of the same class), and instantiate a new workflow (of the same activity).
For instance, my class DoSomeJobClass asks user to scan several items, once they are all scanned, I show a toast message, and start a new DoSomeJobClass to initiate a new scanning task for user. I acquire the scanner resource and perform the related initialization work in onResume() of DoSomeJobClass, and release and de-init the resources in onPause() of DoSomeJobClass.
 
Any hint/suggestions on what could cause the above exception?

Please Register or Login to post a reply

1 Replies

K Kerry Wei

One more observation:
If I turn on debugger and try to debug, I'm not able to produce the error. Maybe because the switch between DoSomeJobClassActivity in debug mode is really slow, and its somehow related?
White in regular mode, if I perform the scanning really fast and navigate to next DoSomeJobClassActivity really quick, I can always produce this error.
However, the release code in onPause() is really called no matter how slow/fast I switch between DoSomeJobClassActivity

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