android apk's silent installation

与世无争的帅哥 提交于 2020-01-01 02:36:07

问题


I'm searching for a way to program my application to install silently an apk file. I'm aware about the possibility to launch code looks something like this:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive");
startActivity(intent);   

but this code raising before the installation starts a dialog with the apk's require permissions and needs the user to authorization to start the installation.

Is there any way to skip this dialog? Is there any other way to install application on run-time from my code that don't requires the user interaction?


回答1:


No. And that's a good thing, this would be an (other) open door to malware and unwanted installs. Why do you want to do that, if you mind me asking? What's wrong with letting users know that you want to install something on their device?

Also, some details here: Silent installation on Android devices

And finally, this might be possible for rooted devices: if you write your own installer, you can bypass completely the built-in installer, and with root privilege, you can basically do what you want. But I still think that would be a serious breach of security.




回答2:


Yes you can but you need root access or your app must be system signed app. You can install app silent by using shell commmand pm install "apk path" This will definatly work i have already created a sample app for same



来源:https://stackoverflow.com/questions/8077779/android-apks-silent-installation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!