Android 6.0以上系统在其他应用上弹出对话框权限处理

if (Build.VERSION.SDK_INT >= 23) {
if (!Settings.canDrawOverlays(getActivity())) {
try {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
Uri.parse("package:" + getActivity().getPackageName()));
startActivityForResult(intent, 10);
} catch (Exception e) {
e.printStackTrace();
}
} else {
checkCredit();
}
} else {
checkCredit();
}

@RequiresApi(api = Build.VERSION_CODES.M)
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 10) {
if (Settings.canDrawOverlays(getActivity())) {
checkCredit();
}
}
}

你可能感兴趣的:(Android 6.0以上系统在其他应用上弹出对话框权限处理)