• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Killing processes

Hello All,

I'm developing an application like an Task Killer, but not exactly.
My application needs to kill a specific process.

I'm using this code below to get the running processes:
Code:
ActivityManager actvityManager= (ActivityManager) this
		.getSystemService(ACTIVITY_SERVICE);
		List<RunningAppProcessInfo> procInfos = actvityManager.getRunningAppProcesses();

Into each RunningAppProcessInfo, it has the PID.
I thought I could use this: Process.killProcess(info.pid);
But it only works to my own app or a process that was started by my application.
But I need to kill other processes from the list.
Someone else knows how can I kill any process?
Any Task Killer app does that, someone knows how they do it?

Thanks!
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones