Alarm in AlarmManager is erased when the process is killed

I am new to android, so please carry me. My main activity creates an alarm in the alarm manager, which should be triggered at a certain time, and my main activity also creates a Broadcast receiver, which assumes to get an intent that triggers an alarm, everything works fine until the task manager destroys my application. I check the PendingIntent list in the AlarmManager and check that my alarm is erased from the alarm manager, I try to add a service and register an alarm from the service, I have red, perhaps because my broadcast receiver IntentFilter is defined in the code, and not in the manifest, it is killed after the application process is killed, and I got stuck on this issue for two weeks :-(, with a lot of confusion, is my design wrong?

Here are my needs:

  • That the alarm clock will be very reliable, even if the application is killed or even if the phone restarts.
  • The same applies to the broadcast receiver.

Thanks in advance,

+5
source share
1 answer

If a user task kills or forces your application to stop, your alarms are not logged. And, on Android 3.1+, nothing from your application will be launched again until the user manually starts performing one of your actions.

There is nothing that you could do about this, except to do everything possible to write a high-quality application that the user does not need or want to force stop.

+6
source

All Articles