Skip to content

Reactive implementation of Android runtime permissions based on RxJava 3

Notifications You must be signed in to change notification settings

lvabarajithan/RxPermissions

Repository files navigation

RxPermissions

Reactive implementation of Android runtime permissions using RxJava3.

Usage

This library provides simple and lightweight apis that emitts PermissionResult.

Requesting for permissions:

RxPermissions(this).request(...)

Request for permission results (skips granted permission results):

RxPermissions(this).requestSkipGranted(...)

Request for simple permission (Emitts true or false):

RxPermissions(this).requestSimple(...)

The PermissionResult model:

PermissionResult.index      // The index of requesting permission order
PermissionResult.permission // Manifest.permission.XXX
PermissionResult.granted    // true or false
PermissionResult.rationale  // true or false

Incase of Android version < M, result is always true.

Points to remember

  1. Already granted permission results are emitted as soon as requested with .request(...) method. (Eg. If camera permission is already granted, you can start the camera related work, while Android system is asking for remaining permission)
  2. Use .requestSkipGranted(...) method to skip the results of already granted permission results.
  3. Use .requestSimple(...) method to get just true or false values, if you don't care about rationale permission results.

Download

implementation 'com.abarajithan.rxpermissions:rxpermissions:1.0.0-beta'

You need to add jcenter() to project level build.gradle file.

License

Copyright 2020 Abarajithan Lv

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Reactive implementation of Android runtime permissions based on RxJava 3

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages