I have a device that has a physical button on the side, when i tap the button it "execute" a custom intent, I'd like to execute a custom function in my application every time the user taps that button, is it possibile?
Asked
Active
Viewed 119 times
-1
-
Possible duplicate of [Catch keypress with android](https://stackoverflow.com/questions/2261914/catch-keypress-with-android) – Daniel Gunna Nov 06 '19 at 14:11
1 Answers
0
Take a look at : KeyEvent handling in android?
https://stackoverflow.com/a/2262020/8513494
You must do something like the answer above, but instead of KeyEvent.KEY_CODE_ENTER use the constant corresponding to the desired button.
To see more details: https://developer.android.com/training/keyboard-input/commands
https://developer.android.com/reference/android/view/KeyEvent

Daniel Gunna
- 327
- 2
- 8