1. Check out our app, Forums for Android! Download and leave feedback here!

Closing a process when Process ID & Process Name is known

Discussion in 'Application Development' started by jhoondlani, Mar 17, 2010.

  1. jhoondlani

    jhoondlani New Member
    Thread Starter
    5

    Mar 12, 2010
    1
    0
    5
    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
     

    Advertisement

Share This Page

Loading...