I am writing a task manager service and need to force close any running process, lets say browser, I tried using killBackgroundProcesses,restartPackage,killProcess but none of these force closes process ( e.g browser ) when process is on front else they are working.
I want to force stop the process even when process is running on front.
What should I do now ??
I had this problem like you.I used a method in the service that killed the background process.So whenever i need to kill process that is running in the foreground i just brought my Activity in the foreground.So the process want to kill automatically goes background and can be killed with killBackgroundProcess.
But surely this is not really a good practice