thej
thej

Reputation: 648

How to install the apk which is sd card with out user intervension?

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.

Upvotes: 3

Views: 879

Answers (2)

Shadow
Shadow

Reputation: 6899

@thej: no way.Want to agree with android security procedure and then only you can install.

Because android gives more importance to OS. Since Android OS is like a bulletproof and apps

are sticked in that bulletproof. So android protects OS by checking the security of apps and

then provides user to install.

Upvotes: 0

mpeerman
mpeerman

Reputation: 2040

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.

Upvotes: 2

Related Questions