Android点播权限请求



如何处理android点播权限请求中的不要再问我。如果用户选择不要再问我,稍后如果他想获得任何最佳实践建议,他们有什么最佳实践吗?谢谢

shouldShowRequestPermissionRationale将帮助您实现这一点。

shouldShowRequestPermissionRationale()将用于检查用户是否已选择"不再询问"。它将返回True或False的值,如果用户在返回False之前选择了Never ask,否则将返回True。

boolean shouldShow = shouldShowRequestPermissionRationale(Manifest.permission.READ_EXTERNAL_STORAGE);
if (!shouldShow) {
    // show some dialog which will give information about required permission, so that user can understand what is need of that permission.
}

点击对话框中的按钮,您可以将用户重定向到应用程序的设置屏幕。

Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,Uri.fromParts("package", getPackageName(), null));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

如果您正在处理预棉花糖,则需要使用ActivityCompat.shouldShowRequestPermissionRationale()

最新更新