Skip to content

Android 6.0 marshmallow 动态权限适配,采用不可见Fragment方式,减少代码入侵、 targetSdkVersion>=23的权限适配方案

Notifications You must be signed in to change notification settings

happylishang/PermissionCompat

Repository files navigation

用法

1、引入依赖

 implementation 'io.github.happylishang:marshmallowpermission:1.5.0'

2,项目使用:

Android 6.0权限适配,采用不可见FragmentDialog方式,减少代码入侵

PermissionCompatUtil.requestPermission(final FragmentActivity activity, final SimpleOnGrantedListener listener) {

    PermissionCompatUtil.requestPermission(activity, PERMISSION, 0, new SimpleOnGrantedListener() {
        @Override
        public void onGranted(int requestCode, String[] permissions) {
            listener.onGranted(requestCode, permissions);
        }

        @Override
        public void onDenied(int requestCode, Map<String, Integer> result) {
            listener.onDenied(requestCode, result);
        }

        @Override
        public void onNeverAsk(int requestCode, Map<String, Integer> result) {

        }
    });
}

About

Android 6.0 marshmallow 动态权限适配,采用不可见Fragment方式,减少代码入侵、 targetSdkVersion>=23的权限适配方案

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages