问题描述
使用AlarmManager我的应用程序设置的报警,如果
清除- 在用户的力量关闭在设置我的应用程序。
- 在一些任务杀手级应用自动杀死我的应用程序的过程。
- 在Android的自身被杀,因为内存的正面应用程序需要我的应用程序。
请告诉我,我怎么发现的呢?而如何设置我的报警器,使所有这些情况下,不影响我报警。
是的,这将清除报警。
这不会对任何最新版本的Android并不清楚报警。
这不清除警报。
时保持你的闹钟去年发生的记录(例如,共享preferences
)。当你的code运行时(例如, LAUNCHER
活动启动),检查最后报警时间。如果这是一个很久以前的事,你知道你的报警被清除,所以你需要重新计划。
这是不可能的。有少数情况下报警居然被清除(重启和强制停止),并有可以被清除在这种情况下做prevent你报警没有。
The alarms set by my app using AlarmManager are cleared if
- The user force closes my app in the settings.
- Some task killer app auto-killed my app process.
- Android itself killed my app, because of the need of memory for front apps.
Please tell me how do I detect it? rather how to set my alarms so that all these cases dont affect my alarms.
Yes, this clears alarms.
This does not clear alarms on any recent version of Android.
This does not clear alarms.
Maintain a record of when your alarm last occurred (e.g., in SharedPreferences
). When your code runs (e.g., LAUNCHER
activity is started), check the last-alarm time. If it was a long time ago, you know that your alarms were cleared, and so you need to reschedule them.
This is not possible. There are few cases where the alarms actually are cleared (reboots and Force Stop), and there is nothing you can do to prevent your alarms from being cleared in those cases.
这篇关于如何重置报警,如果应用程序是在android的强制关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!