I want to uninstall android app without user prompting in android 7 rooted device.I tried below code.
try {
Process su = Runtime.getRuntime().exec("su");
DataOutputStream outputStream = new DataOutputStream(su.getOutputStream());
outputStream.writeBytes("pm uninstall " + packageName + "\n");
outputStream.writeBytes("exit\n");
outputStream.flush();
su.waitFor();
return true;
} catch (IOException e) {
return false;
} catch (InterruptedException e) {
return false;
}
It's working fine in android 6.But version 7,we can't execute su command.
please anyone know any method to do this without user prompting,share with me that code.
or tell me can we execute adb uninstall packageName likewise