框架整理系列十五(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 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 175,014评论 25 709
  • 你好,申请入驻今日头条,本人媒体名称:小笑蜜蜜 二货媳妇怀孕快半年了,反应很大,各种狂吐,导致她心情经常不high...
    小笑蜜蜜阅读 1,306评论 0 0
  • 一,我不知道我是谁 人生只要有裂缝,阳光才能照进来…… “行啦!别说话啦!烦不烦!安静会...
    雪羽天使阅读 2,206评论 0 0
  • 世间美丽的皮囊太多,有趣的灵魂太少。姜思达不只好看、有趣,还特立独行。他头戴红花,骑着白马,施施然飘过,无视一路的...
    烟行阅读 3,813评论 2 3