use of io.envoyproxy.envoy.config.rbac.v3.Permission in project DevRing by LJYcoder.
the class PermissionManager method requestEach.
// 请求单个权限建议用这个
public void requestEach(FragmentActivity activity, final PermissionListener listener, String... permissions) {
if (activity != null) {
RxPermissions rxPermissions = new RxPermissions(activity);
rxPermissions.requestEach(permissions).subscribe(new Consumer<Permission>() {
@Override
public void accept(Permission permission) throws Exception {
if (permission.granted) {
// `permission.name` is granted !
if (listener != null) {
listener.onGranted(permission.name);
}
} else if (permission.shouldShowRequestPermissionRationale) {
// Denied permission without ask never again
if (listener != null) {
listener.onDenied(permission.name);
}
} else {
// Need to go to the settings
if (listener != null) {
listener.onDeniedWithNeverAsk(permission.name);
}
}
}
});
}
}
Aggregations