how can that?
current solution
i launch transparent activity, catches press, forwards service , closes afterwards. activity visible in current running activities , therefore it's not beautiful solution.
solutions seen
i've seen app catch press in service - without activity catches press. if show current running activities, there nothing app.
question
how can done? i've read many threads say, not possible, can see, there apps achieve somehow...
i think found out how works... don't use windowmanager.layoutparams.flag_not_focusable in overlays views + overwrite dispatchkeyevent of view:
@override public boolean dispatchkeyevent(keyevent event) { if (event.getkeycode() == keyevent.keycode_back) { // handle press // if (event.getaction() == keyevent.action_down) return true; } return super.dispatchkeyevent(event); }
Comments
Post a Comment