感谢TasKiller我有可靠的方法来关闭来自AlarmManager的AppWidget更新!
现在,讽刺的是,如何从这样的事件中恢复过来?到目前为止,我只看到警报只有在重新启动手机后才能恢复.
我可以将恢复代码粘贴到几个地方,例如属于我的应用程序和我的小部件的各种Activity#onCreate但是有更好的方法吗?
如果警报正常怎么办 – 有没有办法检测到它而不是运行AlarmManager #setRepeating?
或者多次运行会有害吗?
解决方法
Now,sarcasm aside,how do I recover
from such event?
我听说单一麦芽苏格兰威士忌有帮助.
So far I only see that the Alerts are
resurrected only after rebooting the
phone.
仅当您挂钩BOOT_COMPLETED广播Intent并重新建立警报时.
任务杀手非常彻底,但他们无法阻止BroadcastReceiver接收系统广播,如BOOT_COMPLETED.欢迎您找到您希望收到的其他广播,以帮助重新获得控制权并重新建立警报.
Also what if the alerts are OK – is
there a way to detect that and not run
AlarmManager#setRepeating? Or is there
a harm to run it multiple times?
您可以取消()现有警报.因此,如果您担心可能的重复,请取消()当前警报(如果警报不存在,希望安静地失败),然后设置警报.