Matt
Matt

Reputation: 13

Android AlarmManager alarm being killed by task mgr

So I've been writing an app that uses an alarm to open a service ever few hours or so. My Galaxy S2 Skyrocket has a built in Task Manager that allows me to "Exit" recently opened applications. After I set the alarm if I go into the Task Manager and "Exit" my app its killing my alarm. Is there a way to prevent this?!

Upvotes: 0

Views: 786

Answers (1)

Erol
Erol

Reputation: 6526

It is understandable because you are forcing the system to get rid of the application in Task Manager and therefore the services it is running.

If you observe DDMS in Eclipse, you will recognize that whenever your service starts running, you will see the name of your application appearing under the list. Thus, by asking your alarmmanager to continue running even when you are forcibly closing the application, you are imagining about a virus-like application and a user would not want that.

If your application being terminated by Task Manager is a high possibility, then an alternative could be creating another back-up application that monitors if your service is running on time and fire an intent to start it if not. This would lead to an infinite loop of applications monitoring each other though and I am not sure how practical it could be.

Upvotes: 1

Related Questions