Android - Kill App from another App (on a rooted device)

前端 未结 1 833
面向向阳花
面向向阳花 2021-02-11 00:59

I have a rooted Android device. At one point I launch a secondary application from my primary application like so:

Intent intent = getPackageManager().getLaunchI         


        
1条回答
  •  -上瘾入骨i
    2021-02-11 01:27

    Found a solution:

    Process suProcess = Runtime.getRuntime().exec("su");
    DataOutputStream os = new DataOutputStream(suProcess.getOutputStream());
    
    os.writeBytes("adb shell" + "\n");
    
    os.flush();
    
    os.writeBytes("am force-stop com.xxxxxx" + "\n");
    
    os.flush();
    

    0 讨论(0)
提交回复
热议问题