带有 BroadcastReceiver 的清单中的 ACTION_USER_PRESENT
对于是否可以通过清单捕获 ACTION_USER_PRESENT 屏幕解锁似乎存在不同意见。
此线程暗示不,它无法完成:
Android Broadcast Receiver Not Operating
此线程意味着可以做到:
广播接收器ACTION_USER_PRESENT,ACTION_SCREEN_ON,ACTION_BOOT_COMPLETED
我无法使该事件与 2.3.3 或 3.2 模拟器配合使用。
最近还有其他人有这方面的经验吗?也许还有一个可以分享的代码示例?
There seems to be different opinions on whether it is possible to catch the ACTION_USER_PRESENT screen unlock through the manifest.
This thread implies no it can't be done:
Android Broadcast Receiver Not Working
This thread implies yes it can be done:
Broadcast Receiver for ACTION_USER_PRESENT,ACTION_SCREEN_ON,ACTION_BOOT_COMPLETED
I'm not able to get the event working with either a 2.3.3 or 3.2 emulator.
Does anyone else have recent experience with this? And perhaps a code sample to share?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用接收器:
并在您的清单中:
Use a receiver:
And in your manifest:
官方文件说:
因此,只有某些异常可以接收隐式的、清单定义的事件。
简短回答:
所以不可能再在清单中声明它了。但它可以通过上下文注册来使用。
The official document says:
so only some exception can receive implicit, manifest-defined events.
Short answer:
so it's not possible anymore to declare it in the manifest. but it's available by context-registering.