Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AlarmManager when app closed

Simple question, I think. I have the alarm manager instantiated with some allarms set. What happen when the user close the app?

Does the alarm manager still alert me when the alarms are fired? Or the alarm manager object is destroyed with the app?

Because sometimes the alarms are fired and other times not, so I was wondering whether this was the problem.

like image 405
Daniele Vitali Avatar asked Jan 23 '13 18:01

Daniele Vitali


Video Answer


1 Answers

The alarm manager is a system service, and it keeps running after your app is destroyed.

The precision of the alarm might vary, depending on how you set it.

Check the Logcat for the cases where the alarm is fired, but you don't see any effect. ( Maybe is crashing on the background? )

EDIT: A--C is right. Another cause of missing alarms can be the fact that all alarms get wiped on reboot. You can fix this issue by setting up a BroadcastReceiver to listen the boot_completed intent, and re-set the needed alarms.

like image 191
Robert Estivill Avatar answered Sep 20 '22 12:09

Robert Estivill