I am writing an alarm program. My problem is task managers, like advanced task manager or Samsung task manager, remove my alarms when clearing memory. Is there any way of preventing task managers from removing my alarms? Or a way to be notified of "clear memory" and forcing app to recreate alarms again.
Asked
Active
Viewed 1,978 times
4
-
remove alarm or kill yous process? – Farhana Haque Sep 26 '11 at 06:30
1 Answers
0
In short, no. You can re-register your alarms when the user starts your app again, or when the phone is rebooted.

Nikolay Elenkov
- 52,576
- 10
- 84
- 84
-
-
Tell your users to not use task killers if they need your app. If you kill an app, it's gone, that's the way it works. – Nikolay Elenkov Sep 26 '11 at 09:06
-
You know it's hard thing to say to users, because android phone needs periodical task killing! – AVEbrahimi Sep 26 '11 at 09:12
-
No it doesn't. The Android OS does a better job of handling resources than any user or self-proclaimed task manager. If it is out of resources, it will kill a process that is not used to free up memory, etc. No need to mess it up with third-party 'tools'. Read http://android-developers.blogspot.com/2010/04/multitasking-android-way.html and http://geekfor.me/faq/you-shouldnt-be-using-a-task-killer-with-android/ to clear your confusion. – Nikolay Elenkov Sep 26 '11 at 09:28
-
1Thank you, seems we should wait for version after 2.2 where killing processes doesnt kill alarms – AVEbrahimi Sep 26 '11 at 14:16
-
You said **re-register** my alarms, actually I can remove and re-register my alarms during app startup, but is there anyway to findout **if my alarms are still active**? – AVEbrahimi Sep 27 '11 at 06:40
-
Unfortunately, the `AlarmManager` doesn't provide an API for that. If you register with the same parameters (PendingIntent and request code), any existing alarms will be overwritten, so you don't really need to check. – Nikolay Elenkov Sep 27 '11 at 06:54