I need an automatic brute-force method for unrooted Android devices to kill selected apps that keep restarting in the background, i.e. an appropriate "automatic task killer". Ideally, such method entails a kill command running inside an indefinite loop. Two illustrative examples:
- In Windows, you can run the following batch script from the command prompt:
:start taskkill /f /im "process_name" goto start
- In Linux, you can run the following bash script from the terminal:
while true do pkill -f process_name done
What I need is an equivalent for Android, but unfortunately, I do not have any experience with programming Android applications yet.
I have tested several "task killer" apps such as SuperFreezZ, but you can only terminate processes manually with those. If Android decides to restart a terminated or frozen process against your will, the new instance is not automatically terminated, rendering all these apps useless.
Are there any apps out there that can get the job done? If not, is there a simple way to implement a background script for Android and have it run permanently?
IMPORTANT NOTE: I do not - I repeat - I do not care about CPU/memory/battery usage or any overhead caused by the task-killing app. The sole purpose is to kill selected background apps as soon as they get (re)started, be it by Android or user action. A small app or script that just keeps sending appropriate kill commands every few milliseconds would do the job (hence "brute force"). The assumption here is that one cannot prevent Android from restarting apps in the background without rooting the device, but one can keep force-closing them the moment they are launched.
For better motivation, one (out of several) use cases for me is terminating Samsung's infamous Game Optimizing Service (GOS), which cannot be uninstalled even via adb as it gets immediately reinstalled (reminiscent to malware). When terminated by the user, it gets restarted after several minutes. An appropriate task killing app would automate the termination process for the user and ensure that GOS is running only for a miniscule fraction of system run time. There are several more reasons for me to desire such solution, which I do not want to get into here as it is irrelevant to the question.
