我可以在我的应用程序中抑制系统警报吗?
当系统警报弹出时,我的应用程序是否可以“接管”?我的应用程序禁用了空闲计时器,但是当弹出系统警报时,警报似乎正在启用计时器。对此我能做什么?
Is it possible for my app to "take over" when a system alert pops up? My app disables the idle timer, but when a system alert pops up, the alert seems be enabling the timer. What can I do about that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否可以挂钩当您的应用程序进入和退出后台时调用的方法之一?你说,其中之一?
我敢打赌,当这种情况发生时,其中一个会被叫到。当您的应用程序重新获得焦点时,您可以禁用空闲计时器。
编辑:在重新阅读问题时,看起来您正在寻求抑制警报(即不让它们发生)。呵呵,我主要关注你问题的后半部分。
Would it be possible for you to hook into one of the methods that gets called when your app goes in and out of the background? Say, one of these?
I bet one of those gets called when that happens. You can probably disable the idle timer when your app gets the focus back.
EDIT: On re-reading the question, it looks like you're looking to suppress the alerts (i.e., not let them happen). Heh, I focused on the latter half of your question.
您是否试图抑制警报?那么答案是:你不能。
如果您试图防止警报干扰您的应用程序禁用空闲计时器,那么我相信 donkim 走在正确的道路上。
Are you trying to suppress the alerts? Then the answer is: you can't.
If you're trying to prevent the alerts from messing with your app's disabling of the idle timer, then I believe donkim is on the right trail.