No puedo matar otra aplicación de Android

I am trying to kill another android process(app) from another application. But i am not able to do so..

private boolean isReaderAppRunning() {
    ActivityManager activityManager = (ActivityManager)this.getSystemService(ACTIVITY_SERVICE);
    List<RunningAppProcessInfo> procInfos = activityManager.getRunningAppProcesses();
    boolean isFound = false;
    for(int i = 0; i < procInfos.size(); i++){
        Log.e("SSSSSSS NAMEEEEE", procInfos.get(i).processName);
        if(procInfos.get(i).processName.equals("com.bosch.bst_acp")) {
            int pid = android.os.Process.getUidForName("com.bosch.bst_acp");
            android.os.Process.killProcess(pid);
            activityManager.killBackgroundProcesses("com.bosch.bst_acp");
            isFound = true;
        }
    }
    return isFound;

}

I am getting the pid as -1 even after adding the permissions. Can anyone tell me what i have done wrong ?

<uses-permission android:name="android.permission.GET_TASKS"></uses-permission>

preguntado el 01 de febrero de 12 a las 13:02

If I remember correctly since Android 2.2 or 2.3 you can not kill third party processes anymore. With root privileges you could circumvent it. -

ok.... i am trying in ice cream sandwich.. and it does not throw any error -

@ArunAbraham Did you found any solution? I guess you will need root privileges. -

@Numair Hey, it was long ago that i had asked this question, but i could not do it. It was deprecated i guess. -

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.