Search code examples
androidevent-handlingandroid-softkeyboardkeyboard-eventsmotorola-droid

Android - Is it possible to intercept the input event without the input field and an open soft- keyboard?


Is it possible to somehow catch the text input event if the application does not display EditText (the text box), and there is not soft-keyboard?

OS: Android 4.1.2

P.S. Let me explain why this is necessary: there is a device - Motorola TC55 - (data collection terminal, smartphone on Android 4.1.2 with barcode reader (laser)), which on its left side has a button for scanning.

After pressing it the laser scanner is turned on, reads the barcode and after the reading of the barcode symbols that are read are programmatically "pressed".


Solution

  • A different solution should be to leverage the Intent made available by these devices when they read a barcode.

    You can find more information in the developer documentation for the TC55, it's simply to configure the device so that it send an Intent with the barcode data to your application.

    This configuration can be exported and reused on different device. another option is to have your application setting up the configuration programmatically using TC55's Profile API. In this way you can fine tune the barcode decoder for your use case.

    Using DataCapture Intents it's much cleaner that using the simulated keyboard entry.