Blankj / Blankj/AndroidUtilCode

PermissionUtils申请权限回调中, 使用ToastUtils发现无法弹出

Open
#1,660 0 comments 0 reactions 1 assignee View on GitHub

@Blankj is already working on this.

Since Jun 20, 2022.

bug
Dominant language
Java
Stars
33.6k
Forks
10.6k
PR merge metrics
No merged PRs in 30d

Description

描述 Bug

PermissionUtils申请权限回调中, 使用ToastUtils发现无法弹出, 只有设置 defaultMaker.setNotUseSystemToast() 才会有效. 有办法继续使用SystemToast?

  • AndroidUtilCode 的版本:1.31.0
  • 出现 Bug 的设备型号:MI9
  • 设备的 Android 版本:API 30

相关代码


        PermissionUtils.SimpleCallback permissionCallback = new PermissionUtils.SimpleCallback() {
            @Override
            public void onGranted() {
                // handles
            }

            @Override
            public void onDenied() {
                // 这里调用不会弹出。 只有设置 defaultMaker.setNotUseSystemToast() 这里才会有效
                ToastUtils.showShort("被永久拒绝授权,请手动授予相关权限");
               // handles
            }
        };

        if (PermissionUtils.isGranted(permissionArray)) {
            permissionCallback.onGranted();
        } else {
            PermissionUtils.permission(permissionArray).callback(permissionCallback).request();
        }

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.