I written a application which install the apk to device. I stored the apk in sd card. I tried Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File("/sdcard/MyApp.apk")), "application/vnd.android.package-archive");
startActivity(intent);
But I will get a window to ask wether to install or not. I do not need user intervention to install my .apk. What I can try?
So i tried to install using command line arguement Runtime.getRuntime()
.exec("adb -d install /sdcard/MyApp.apk");
I am getting null environment error. How can I access to apk in sd card and how can I install it?
Thanks for the help.
I do not believe this is possible. If it was what would stop people from writing apps that install rouge apps and viruses. If you have a legit reason for having it install an apk then just request the user to install it and explain what its for.
Also its part of android security procedure so users can see the requested permissions and agree to them before an app can work on the device.