MC9300 [physical keyboard] - Listen button calls

G Gaurav Sonkusare 3 years 7 months ago
7 1 0

Hello,
I have an app based on ionic 4 and angular 8 where I need to integrate the hard keyboard buttons to app buttons.
Can get button calls for alphabets and numerics but not for P1 and P2 and Dpad buttons.
For eg:-
const keypressoutput = document.getElementById('pressed_keys');
alert("btn pressed Event: " + JSON.stringify(e.key));
if (e.key == "P1") {
// close app.
}
Can someone help me?

Please Register or Login to post a reply

1 Replies

D Darryn Campbell

I'm afraid I do not have a device so this will be somewhat speculative but here are a few ideas:

You are looking for a keypress event but did you try checking for a keydown event?  Some keys emit a keydown but not a keypress.
According to https://www.zebra.com/content/dam/zebra_new_ia/en-us/manuals/mobile-com…, the P1 key is the PTT key by default.  You should be able to listen for the PTT key using Intents, try https://github.com/darryncampbell/EMDK-PTTKeys-Demo to see if the P1 key gives you anything.
You should be able to remap the key using the on-device UI (Settings --> Key Programmer).  You can remap the P1 and other keys to some keys that your application will recognize but that are not typically used.
You should be able to remap the key using MX and the StageNow tool, https://techdocs.zebra.com/mx/keymappingmgr/, again, to remap the keys to other keys that your application will recognize.

Note that the second two bullets are device-wide

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