Android Question Cancel scan

CurtisC

Member
Licensed User
Longtime User
I am using abzxing and need the scan canceled if no code is read. Researched all of the posts I could find and the most promising was a example created by NJDude. It cancels the scan but appears to continue running. I have not found a way to confirm but the abzxing is part of an app that acts as a menu and once a scan is canceled any apps opened from the menu are closed 10 seconds later. Only the app with abzxing is allowed to be open.

I need some method to cancel a scan whether by timer as NJDude or some control other than the device controls. Seeking all suggestions and wondering if the scan read method from Icefairy333 offers the control I am seeking.
 

CurtisC

Member
Licensed User
Longtime User
Thanks NJDude, While I am far down the knowledge ladder I believe the sample code that likely took you 5 minutes is very close to being the entire answer. Plus the B4Abzxing also exits the app so probably the same problem.

The service module was not exclusive to abzxing so it was closing any app called but that was seems to be due to a startservice in the activity_pause. So returning to the app appears is resolved but the scan is not being canceled just being put into the background.

How can abzxing be closed? Can the back button be controlled through code or is it possible to close the current activity which would be abzxing?
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
The ABZXing library is calling the Barcode Scanner app, it's a separate process, therefore, your app doesn't have control over it, in other words, what you are trying to do is one app trying to close another app, such things are possible (most of the time) but require some coding, the OS Library has some functions that allow you to do that, but, it has its problems, and since you said you are still learning, that might look (and it is) a little complicated and sometimes unreliable.
 
Last edited:
Upvote 0
Top