I am developing an Android app that functions as an alarm. I want to be able to dismiss the alarm using hardware buttons such as power, camera or volume buttons.
The functionality that I want is exactly like Android's Dialer and Alarm where the ringing sound stops when any of the buttons are pressed. The difference from my app from the two is that my app does not have a foreground activity when the alarm fires, just a normal notification.
I see from other questions that it is not possible to listen to hardware key presses in service. Any ideas on achieving this?