Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

判断MIUI的打电话权限,该如何处理? #2

Open
xingstarx opened this issue Feb 8, 2017 · 0 comments
Open

判断MIUI的打电话权限,该如何处理? #2

xingstarx opened this issue Feb 8, 2017 · 0 comments

Comments

@xingstarx
Copy link

看了作者的库,有个想法,如果我想要判断的是打电话权限呢,该如何处理呢?

对于打电话的权限是public static final int OP_CALL_PHONE = 13; 在api>=19以上反射是可以的,那么对于在api<19以下该如何处理呢?有什么思路吗?身边也没有xiaomi手机是android4.4以下的了。 希望能给点建议。

我贴一下,你判断MIUI的悬浮窗权限的代码

/**
     * 判断MIUI的悬浮窗权限
     *
     * @param context
     * @return
     */
    @TargetApi(Build.VERSION_CODES.KITKAT)
    public static boolean isMiuiFloatWindowOpAllowed(Context context) {
        final int version = Build.VERSION.SDK_INT;
        if (version >= 19) {
            return checkOp(context, 24);  // AppOpsManager.OP_SYSTEM_ALERT_WINDOW
        } else {
            if ((context.getApplicationInfo().flags & 1 << 27) == 1 << 27) {
                return true;
            } else {
                return false;
            }
        }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant