框架整理系列十五(Android M 权限)

引用

   //rxAndroid
   compile 'io.reactivex.rxjava2:rxjava:2.0.8'
   compile 'io.reactivex.rxjava2:rxandroid:2.0.1'

   compile 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.4@aar'

使用

RxPermissions rxPermissions = new RxPermissions(this); // where this is an Activity instance

// Must be done during an initialization phase like onCreate
rxPermissions
    .request(Manifest.permission.CAMERA)
    .subscribe(granted -> {
        if (granted) { // Always true pre-M
           // I can control the camera now
        } else {
           // Oups permission denied
        }
    });
框架整理系列十五(Android M 权限)_第1张图片

你可能感兴趣的:(框架整理系列十五(Android M 权限))