Well I have an application that tests if there's a SIM change every time the phone boots and if it is, it starts a certain ser开发者_如何学运维vice. I want to override a certain combination of keys, let's say for example the volume up key with the boot key, that if pressed together at the phone boot will stop the service even if the SIM is changed. How can I do it? Thx a lot
There is no "boot key".
For keys that exist, in your activity, you can listen for KeyEvents
via onKeyDown()
. However, you cannot listen for KeyEvents
outside of one of your activities -- that would be a massive security hole.
精彩评论