本文介绍了请问,如果应用程序是由于内存不足杀死系统中的AlarmManager报警持续?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经知道,如果你的应用程序被强制通过一个应用程序杀手关闭,或者通过Android的设置,你的未决报警丢失。但是,如果机器人本身把它打死了,由于非常低的内存。请问你的报警器会丢失在这种情况下?多久这实际上发生的呢?

我看到两种方法可以从丢失报警恢复:

  1. 如果您的应用程序有一个主要活动,使用的onCreate()来检查,如果你的报警晚点运行(报警器应保存一次最后的跑了preF),并在必要时重新安排。

  2. 查找一些常见的经常性的Andr​​oid任务含住一个接收器做同样的检查方法同上。

两者都具有一些明显的主要缺点。任何其他的想法?

解决方案

肯定是在Android 2.1的一个任务的杀手和更早有这样的效果。我不知道,使用设置应用程序有这样的效果,虽然我还没有尝试过。

没有。

I already know that if your app is forced closed by an app killer, or through the Android settings, your pending alarms are lost. But what if Android itself killed it due to very low memory. Would your alarms be lost in this case? How often does this actually happen?

I see two ways to recover from losing an alarm:

  1. If your app has a main activity, use onCreate() to check if your alarm is running behind schedule (alarm should store the time it last ran in a pref), and reschedule it as necessary.

  2. Find some common recurring Android task to latch onto with a receiver to do the same check as above.

Both of these have some obvious major cons. Any other ideas?

解决方案

Definitely a task killer on Android 2.1 and earlier has this effect. I am not aware that using the Settings app has this effect, though I have not tried it.

No.

这篇关于请问,如果应用程序是由于内存不足杀死系统中的AlarmManager报警持续?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 04:19