android - How to handle home button click event in custom lock screen application -


i working in project custom lock screen must implemented once user clicks lock button. after clicking, application should locked , should prevent closing app while pressing home button. used following code disable home key pressed state:

@override     public void onattachedtowindow(){          log.i("teste", "onattachedtowindow");         this.getwindow().settype(windowmanager.layoutparams.type_keyguard);         super.onattachedtowindow();      }     public boolean onkeydown(int keycode, keyevent event){     if (keycode == keyevent.keycode_home) {         log.i("teste", "botao home");         return true;     } 

the problem above method not working latest versions. helpful if mentor me alternative solutions achieve task. in advance

you can not override home key button.


Comments