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

Apps Closing a process when Process ID & Process Name is known

Hi All,
I am having a requirement that i want to close a process that is running from my application.
For Example :
If a pdf file is opened in the device, i want that if my application is launched it should close.
I am able to get the process id i.e 620 & process name : "com.htc.pdfreader"
by using
for (int i=0;i<appList.size();i++)
{
RunningAppProcessInfo rti = (RunningAppProcessInfo)appList.get(i);
Log.v( "", "PID"+rti.pid+"Process Name"+rti.processName );
}
Now, for closing this i have tried
android.os.Process.killProcess(Process ID);
But no success.
then i tried :
process = Runtime.getRuntime().exec(rti.processName);
process.destroy();
again it was not successful.
Can you please let me know how this can be achieved.
Thanks
Jaya
 
Back
Top Bottom