How to kill another user background process?

I cannot kill another user background process using ActivityManager.killBackgroundProcesses .

Used code:

ActivityManager am = (ActivityManager)getSystemService(ACTIVITY_SERVICE); for (RunningAppProcessInfo pid : am.getRunningAppProcesses()) { if (pid.processName.equals("com.example.sample")) am.killBackgroundProcesses("com.example.sample"); } 

Where com.example.sample is the background process package that I want to remove.

This process is still running in the background after that.

+2
source share
1 answer

You can only kill your own applications, for example. those that work in the same process or with the same user ID. You cannot kill others if the device is not rooted.

Check out this answer though about the β€œkilling” of background application processes.

0
source

Source: https://habr.com/ru/post/1239584/


All Articles