启动时覆盖组合键
我有一个应用程序可以测试每次手机启动时 SIM 卡是否发生变化,如果是,它就会启动特定服务。我想覆盖某些按键组合,例如音量增大键和启动键,如果在手机启动时同时按下,即使 SIM 卡已更改,也会停止服务。我该怎么做呢? 非常感谢
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 service. 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有“启动键”。
对于 Activity 中存在的键,您可以通过
onKeyDown()
监听KeyEvents
。但是,您无法在您的活动之一之外侦听 KeyEvents - 这将是一个巨大的安全漏洞。There is no "boot key".
For keys that exist, in your activity, you can listen for
KeyEvents
viaonKeyDown()
. However, you cannot listen forKeyEvents
outside of one of your activities -- that would be a massive security hole.