How can i do that?
Current solution
I launch a transparent activity, that catches the back press, forwards it to my service and closes itself af
If you have an overlay window attached in a WindowManager in your service, put your view the attribute setFocusableInTouchMode(true), and put a key listener. You'll receive key events, like in this example:
view.setFocusableInTouchMode(true);
view.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK) {
stopSelf();
return true;
}
return false;
}
});
Edited, I didn't use good stackoverflow account