I am trying to figure out how I can prevent a user from killing an application using force-stop. I am trying to detect when user opens an activity such as Settings-Applications-Manage Applications and tries to force-stop a protected app. Also there are some task manager apps that allow you to kill processes.
I know it is possible in Android, since apps like AppLock or Super AppLock do it. I just can't find any information on how to do it.
Right now I am trying to poll ActivityManager.RunningTaskInfo to detect the restricted activities, however that does not work well as they have different names on different devices.
Is there a better way to do it? How do AppLock and similar apps implement this functionality?