I'd like to detect when a user presses any hardware button on a sleeping android phone (or at least the home and the power button).
Until now I have used a BroadcastReceiver for the ACTION_SCREEN_ON event, which works great but it is also raised when e.g. you get a message, a phone call or when an alarm starts.
ACTION_USER_PRESENT is also no option because this is only raised when the user really is present an knows the unlock code, so he isn't tampering with the phone.
Is there a way to handle that?
no its not possible but this can be used for other purpose