Android 新版本的出现 ,适配Android8.0未知来源应用安装权限处理
1、在清单文件中增加请求安装权限
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
private void showChangCityDialog() {
CustomDialog.Builder builder = new CustomDialog.Builder(mContext);
builder.setTitleStr("提示");
builder.setBodysStr("安装应用需要打开未知来源权限,请去设置中开启权限");
builder.setLeftbtnStr("取消");
builder.setRightbtnStr("设置");
builder.setLeftBtnColor(R.color.color_333333);
builder.setrRightBtnColor(R.color.C6);
builder.setOnClickListener(new CustomDialog.DialogOnItemClickListener() {
@Override
public void leftClick() {
finish();
}
@Override
public void rightClick() {
//兼容8.0
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
bo