Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I send keyevents? #717

Open
dingodoppelt opened this issue Jul 25, 2024 · 7 comments
Open

Can I send keyevents? #717

dingodoppelt opened this issue Jul 25, 2024 · 7 comments

Comments

@dingodoppelt
Copy link
Contributor

dingodoppelt commented Jul 25, 2024

Hi there,
sorry for posting a question rather than an issue.
I need to send a custom keyevent to an app, which I currently achieve by adb shell input keyevent 82.
Is it possible to assign a keyevent to a key in a custom layout?
cheers, nils

@ChiefMikeK
Copy link

Javascript Char Codes (Key Codes) - Cambia Research https://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes
doesn't r work?

@dingodoppelt
Copy link
Contributor Author

dingodoppelt commented Jul 25, 2024

Javascript Char Codes (Key Codes) - Cambia Research https://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes doesn't r work?

Those are keycodes, what I mean are android keyevents. In my partiular case I'm using an old app that relies on a Menu button to be present. Android doesn't have the menu button anymore (the app is VERY old ;) but I can still open the menu by sending the keyevent via adb. My question was, if unexpected keyboard has the ability to send keyevents (which are not keycodes) to an android app.

edit: https://developer.android.com/reference/android/view/KeyEvent

@Julow
Copy link
Owner

Julow commented Jul 25, 2024

That's not possible at the moment but would be a great addition to the app. Would you be willing to implement it ?

The KeyValue class can already represent the new key and we just need a way to construct it. KeyValue.getKeyByName would be the best place to implement the new key syntax. The syntax should also allow specifying a label for the key.
The custom key option do not use this getKeyByName function and instead makes raw string keys. It should be able to recognize the syntax too.

@dingodoppelt
Copy link
Contributor Author

That's not possible at the moment but would be a great addition to the app. Would you be willing to implement it ?

I'm not a programmer, but I got #726 to do what I need :) Is this something you can make use of?
cheers, nils

@Julow
Copy link
Owner

Julow commented Jul 27, 2024

Thanks for the PR! That's the perfect way to solve your problem. I'd like to keep this issue open for discussing the other key events.

@dingodoppelt
Copy link
Contributor Author

Thanks for the PR! That's the perfect way to solve your problem. I'd like to keep this issue open for discussing the other key events.

Thanks! Very much appreciated :)

@ChiefMikeK
Copy link

Thanks for the PR! That's the perfect way to solve your problem. I'd like to keep this issue open for discussing the other key events.

remember to update the docs.md 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants