Listen key event


Can anybody provide a full example for nativescript to listen for key events: i.e. when the menu button is pressed or when i run the command: adb shell input keyevent 82 (82 --> “KEYCODE_MENU” , see full list here ). This is what i found for android (java) but i dont know how to implement it to listen in every part of my app.

Thank you!