Java tutorial
//package com.java2s; import java.io.DataOutputStream; import java.io.IOException; public class Main { public synchronized static final boolean uninstallAppSilent(String packageName) { return installOrUninstallApk(packageName, "uninstall", "-k"); } private static boolean installOrUninstallApk(String apkPath, String installOruninstall, String rOrP) { Process process = null; DataOutputStream os = null; String command = null; try { process = Runtime.getRuntime().exec("su"); os = new DataOutputStream(process.getOutputStream()); command = "pm " + installOruninstall + " " + rOrP + " " + apkPath + " \n"; os.writeBytes(command); os.flush(); os.close(); process.waitFor(); process.destroy(); return true; } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } return false; } }