Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

强制更新的BUG #1

Open
xia150608 opened this issue Mar 11, 2019 · 1 comment
Open

强制更新的BUG #1

xia150608 opened this issue Mar 11, 2019 · 1 comment

Comments

@xia150608
Copy link

强制更新进入安装界面后点击取消返回APP界面,弹框消失

@OverHaha
Copy link

强制更新进入安装界面后点击取消返回APP界面,弹框消失
在lib的UpdateFragment中
case UpdateUtils.DownloadStatus.FINISH:
File file = new File(saveApkPath);
if (file.exists()) {
//检测是否有apk文件,如果有直接普通安装
UpdateUtils.installNormal(mActivity,saveApkPath,packageName);
// dismissDialog();
} else {
checkPermissionAndDownApk();
}
break;
注释dismissDialog();可以解决弹窗消失。
但是再次点击返回键,弹框消失

/**
 * 这里主要是处理返回键逻辑
 */
private void onKeyListener() {
    if(getDialog()!=null){
        getDialog().setOnKeyListener(new DialogInterface.OnKeyListener() {
            @Override
            public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
                switch (keyCode) {
                    // 返回键
                    case KeyEvent.KEYCODE_BACK:
                        if (isForceUpdate) {
                            return true;
                        }
                    default:
                        break;
                }
                return true;
            }
        });
    }
}

把最后的 return false改为 true
但是 返回后 dialogFragment的按钮点不了 哈哈哈

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants