My code is supposed to install my app called "xadb-build.apk", But it does nothing, no errors, no force closes, I only see the super user permission granted toast. Here is my approach
File sdCard = Environment.getExternalStorageDirectory();
String fileStr = sdCard.getAbsolutePath() + "/download";// +
// "app-release.apk";
File file = new File(fileStr, "xadb-build.apk");
if (file.exists()) {
try {
String command;
command = "adb install -r " + file;
Process proc = Runtime.getRuntime().exec(
new String[] { "su", "-c", command });
proc.waitFor();
} catch (Exception e) {
e.printStackTrace();
}
}
}
I got this code from here (see palak's answer)
Android supports this method.
And your method is not recommended.