I am trying to build an auto-updater for the Android Things app.apk
. So far I have downloaded the new version of the .apk
into the /sdcard/download/app.apk
and I can also install it from there via the adb terminal e.g.
adb shell
pm install -r /sdcard/Download/app
Now I try to do the same via the device itself. Currently I have this
Process install = Runtime.getRuntime().exec("pm install -r /sdcard/Download/app");
install.waitFor();
But nothing happens. I tried to also open the shell like this, but this time I am getting Cannot run program "su": error=13, Permission denied
Process install = Runtime.getRuntime().exec("su");
DataOutputStream out = new DataOutputStream(install.getOutputStream());
out.writeBytes("pm install -r /sdcard/Download/app");
out.flush();
Is it possible at all to install the downloaded apk from the device itself? The general way with Intent.ACTION_VIEW
doesn't work either. It blanks out and that's it. Nothing happens.