Android安装apk而无需用户许可

时间:2015-09-30 04:51:13

标签: java android android-intent apk android-download-manager

我正在构建一个用于自助服务终端模式的应用程序。该设备没有root权限。 该应用程序是设备管理员(android.permission.BIND_DEVICE_ADMIN)。我希望该应用能够下载并直接安装其他apks到平板电脑,而无需征得许可。

我正在使用Android DownloadManager下载apk: 然后:

Intent intent = new Intent(Intent.ACTION_VIEW);
                                intent.setDataAndType(Uri.fromFile(new File(filePath)), "application/vnd.android.package-archive");
                                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // without this flag android returned a intent error!
                                DownloadManagerActivity.this.startActivity(intent);

安装apk。但这会带来一个确认弹出窗口。 是下载后直接安装apk的另一个吗? 感谢

更新

我遇到过这篇文章: https://paulononaka.wordpress.com/2011/07/02/how-to-install-a-application-in-background-on-android/

但它不起作用而且非常有限。

1 个答案:

答案 0 :(得分:6)

没有弹出确认,无法安装APK。这是一种设计安全功能。像三星这样的手机供应商提供SAFE或KNOX等选项,允许在没有提示的情况下进行安装,但它需要额外的权限,并且这些技术并非在所有Android设备上都可用。