PermissionX
PermissionX copied to clipboard
Android 33 未适配
使用三星手机Android 33 很多权限无法请求到。
Issue facing in android api level 33.
Not working for android 13
read_external_storage permission is causing problem in API level 33
Any update on this ??
Android 13 已经不能用这个权限了 用原生代码也是没有反应 已知是这个权限 Manifest.permission.WRITE_EXTERNAL_STORAGE
Android 13 has new permissions if you want to access media. For example, instead of Read/Write External Storage, you'll need READ_MEDIA_IMAGES permission.
So just do this:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
{
if (PermissionX.isGranted(this, Manifest.permission.READ_MEDIA_IMAGES))
{
openGallery();
} else
{
PermissionX.init(this).permissions(Manifest.permission.READ_MEDIA_IMAGES).onForwardToSettings((scope, deniedList) -> scope.showForwardToSettingsDialog(deniedList, getString(R.string.storage_permission_required_reason), getString(R.string.settings), getString(R.string.cancel))).request((allGranted, grantedList, deniedList) -> {
if (allGranted)
{
openGallery();
} else
{
Toasty.error(context, R.string.permission_denied).show();
}
});
}
} else
{
if (PermissionX.isGranted(this, Manifest.permission.READ_EXTERNAL_STORAGE))
{
openGallery();
} else
{
PermissionX.init(this)
.permissions(Manifest.permission.READ_EXTERNAL_STORAGE).onForwardToSettings((scope, deniedList) -> scope.showForwardToSettingsDialog(deniedList, getString(R.string.storage_permission_required_reason), getString(R.string.settings), getString(R.string.cancel)))
.request((allGranted, grantedList, deniedList) -> {
if (allGranted)
{
openGallery();
} else
{
Toasty.error(context, R.string.permission_denied).show();
}
});
}
}