Back pressed events with system alert window
I need to dismiss system alert window on back pressed and home button event.I have tried with onKeyEvent but in vain. As we can't capture the back pressed event in a service, how to achieve this? Eliran Kuta Since it's a service that hosting an overlay window, It's a bit tricky solution but it is possible. You should handle these 2 cases separately (overriding home button press, and back button press). 1. Overriding home button press: Create this HomeWatcher class which contains a BroadcastReceiver that will notify when home button was pressed. Register this receiver only when your window