Android - capturing hardware button presses while in locked mode
We would like to be able to capture hardware button presses (long clicks) in android 2.3 when the device is locked.
There is a problem to listen to "Volume_changed" event, 开发者_如何学运维as it does not change while the phone is locked.
How can I find the intents fired after pressing the hardware volume button? I know that it is problematic for services to listen to these events, but is it possible to start an activity as a result of this press, when we are in locked mode?
Thanks!
We would like to be able to capture hardware button presses (long clicks) in android 2.3 when the device is locked.
This is not possible.
There is a problem to listen to "Volume_changed" event, as it does not change while the phone is locked.
In your activity, you can call setVolumeControlStream()
to determine what the volume buttons control while the phone is locked and your activity is in the foreground. For a service, near as I can tell, the volume buttons are handled by the audio focus system.
How can I find the intents fired after pressing the hardware volume button?
There are no such Intents
.
but is it possible to start an activity as a result of this press, when we are in locked mode?
No, sorry.
精彩评论