Key events in Perspective App

I’m trying to use Key events in the perspective mobile application. using the following settings, I can’t seem to get it to work.

regex: zach
script:

_l=system.util.getLogger('ztest')
_l.info('zach from keypress event.')

image

It also doesn’t work from a browser on mobile, but it does work from a browser on a computer. I assume it must have something to do with the key press event (maybe a phone doesn’t actually create a key press event?).

Can I get this working?
Device: Zebra TC21 (Android)
Perspective App: v1.0.1-77
Gateway: v8.1.17

Doing some research of my own I found this note at https://developer.android.com/training/keyboard-input/commands:

Note: When handling keyboard events with the KeyEvent class and related APIs, you should expect that such keyboard events come only from a hardware keyboard. You should never rely on receiving key events for any key on a soft input method (an on-screen keyboard).

That doesn’t seem encouraging toward my goal…

For anyone in the future, on the Zebra devices, you can change a setting to ask the barcode scanner to send scanned input at a key event. Keystroke Output - Zebra Technologies TechDocs

This doesn’t fix the soft keyboard issue, but it does let me scan QR codes with the built-in scanner and cause actions to happen, which was my original goal anyway.

1 Like