Emulating barcode scan for testing

I am currently developing automated tests for our Android applications using Espresso, and I’d like to emulate barcode scanning for some of the scenarios by providing pre-defined barcodes. Is it possible, and how? I am currently testing on the Memor20 but it shouldn’t matter which hardware anyways. The Android SDK is the 1.34.

To be more specific, in this case I am not using intents (which would probably make my life easier). Only the BarcodeManager and the registered ReadListener. I thought about using startDecode() from the BM but of course it just turns on the hardware scanner, it does not provide any barcodes. Also, I cannot call onRead() on the listener directly. Any ideas?

Thanks!

Hello @Rodrigo_Tavares,

Welcome to our Forum!

Datalogic does not offer a way to emulate barcode scanning.

The only way I could think to do this would be to switch to using the intent keyboard wedge.
Then you could emulate sending those broadcast intents yourself.