Closed renhuan closed 2 years ago
原因是没有打开 canRequestPackageInstalls权限,代码如下
canRequestPackageInstalls
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { mActivity?.let { it -> if (!it.packageManager.canRequestPackageInstalls()) { val packageURI = Uri.parse("package:" + it.packageName) val intent = Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES, packageURI) it.startActivityForResult(intent, 50000) } else { showVersionDialog(this) } } }
原因是没有打开
canRequestPackageInstalls
权限,代码如下