I developed an application in which a password protects another application (say, application A). Therefore, when I try to open application A, a message appears on the screen stating that the user is entering a password. If the recording is incorrect, it should close this activity and also close application A , which is directly below it .
Now I tried to do this using this code:
List<ActivityManager.RunningAppProcessInfo> pids = Unlock.am.getRunningAppProcesses();
for(int i = 0; i < pids.size(); i++)
{
ActivityManager.RunningAppProcessInfo info = pids.get(i);
if(info.processName.equalsIgnoreCase("com.A")){
pid = info.pid;
break;
}
}
android.os.Process.killProcess(pid);
But that will not work.
Later I realized that this was probably due to the fact that the application A process is not a direct child of my application (that is, my application did not call application A). So I can close, but not have to kill app A from my app? I want to say that killing application A is optional, but closing is mandatory .
source
share