I have an application with call activity, when I finish action in activity the activity is still running in background device. Now I want to stop the activity and not allow it to run in the background when it is finished. I'm also using killBackgroundProcesses
but it's not working.
public void KillApplication(String killPackage) {
ActivityManager am =(ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
android.os.Process.killProcess(runningProcess.pid);
am.killBackgroundProcesses(killPackage);
}
I just call finish();
and then I use the function KillApplication("mypackage");
.