问题描述
我在服务器中获得APK.
我尝试
File apkFile = new File("/sdcard/Download/openapk.apk"); Uri apkUri = Uri.fromFile(apkFile); Intent webIntent = new Intent(Intent.ACTION_VIEW); webIntent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive"); webIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(webIntent);
此代码. 在图片下显示后. 此代码是我单击"安装"按钮时.开始安装. 但是我要自动安装和apk执行
可能会在APK执行后进行自动安装. ?
推荐答案
不可能,这是很好的,因为如果可能的话,这意味着一个应用程序可以在设备上安装任何内容而无需询问用户...
Android将会更加不安全.
问题描述
I get apk in server.
and I try
File apkFile = new File("/sdcard/Download/openapk.apk"); Uri apkUri = Uri.fromFile(apkFile); Intent webIntent = new Intent(Intent.ACTION_VIEW); webIntent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive"); webIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(webIntent);
this code. after showing under picture. this code is when I click install button. start install. but I want auto install .and apk execution
perhaps possible auto install after apk execution. ?
推荐答案
Nope, not possible and it is pretty good because if it was possible, it would mean that an app could install anything on the device without asking the user...
Android would be then even more insecure.