Android 8.0 允许安装未知来源权限
public void installApk(View view) {
File file = new File(Environment.getExternalStorageDirectory(),
"testandroid8-debug.apk");
Intent intent = new Intent(Intent.ACTION_VIEW);
// 仅需改变这一行
FileProvider8.setIntentDataAndType(this,
intent, "application/vnd.android.package-archive", file, true);
startActivity(intent);
}
网友评论