android程序自动安装apk

Xml代码

<uses-permission android:name="android.permission.INSTALL_PACKAGES" />

Java代码

Uri uri = Uri.fromFile(new File("/sdcard/temp.apk")); //这里是APK路径
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(uri,"application/vnd.android.package-archive");
startActivity(intent);

你可能感兴趣的:(android)