Can not handle event onKeyDown

import applicationModule = require("application");
import AndroidApplication =;    

and in ngOnInit:

    let activity = AndroidApplication.startActivity || AndroidApplication.foregroundActivity ;

    activity.onKeyDown =()=>{
        console.log('on key down');

but wen I press volume buttons it doesn’t log the ‘on key down’ but I tested the below code and it worked.

    activity.onBackPressed = () => {
        console.log('on back');

what is the problem with onKeyDown event?


I don’t think it has been exposed, unlike onBackPressed?



I know this thread is quite old, but I’ve been struggling with this for about 3 days and finally could get it to work.

I just extended the NS Activity following the docs ( and added the onKeyDown function.

public onKeyDown(keyCode: any, keyEvent: any): boolean {
    return true;

After that I removed and added the android platform and then, I could just override my own onKeyDown function from the component and everything worked like a charm.