PowerPermission
PowerPermission
is a library to simplify process of demanding RuntimePermission.
You find an
example application
in this Repo or downloading directly here.
Here are some different points compare with other libraries:
- support asking permissions in
AppCompatActivity
andFragment(include ChildFragment)
- support custom rational view after user refuse permission
- support ability to choose permissions to display rational views
- support different interface (RxJava2,RxJava3,Coroutines,LiveData)
How to Download
Basic
Other API Support
OverView
Package Name | Role | Usage |
---|---|---|
powerpermission | Basic core package | implementation "com.qifan.powerpermission:powerpermission:1.0.0" |
powerpermission-rxjava2 | Support RxJava2 | implementation "com.qifan.powerpermission:powerpermission-rxjava2:1.0.0" |
powerpermission-rxjava3 | Support RxJava3 | implementation "com.qifan.powerpermission:powerpermission-rxjava3:1.0.0" |
powerpermission-coroutines | Support Kotlin Coroutine | implementation "com.qifan.powerpermission:powerpermission-coroutines:1.0.0" |
powerpermission-livedata | Support Android LiveData | implementation "com.qifan.powerpermission:powerpermission-livedata:1.0.0" |
How to use
Simple Usage
Singleton
Extension
- Require in Activity
- Require in Fragment
- Require in ChildFragment
RxJava/RxKotlin
Basic Usage
Use with RxBinding
Coroutine
Livedata
Rationale Interface
Custom View
In PowerPermission
it have a interface
which called RationaleDelegate
, it should be used as bridge to create your proper
delegation class to implement this interface
.
It provide two basic public declaration functions,
- displayRationale
- onDismissView
PS: PowerPermission
has already provided a class called DialogRationaleDelegate.kt
to display a classic dialog view you can take a look at it and find more inspiration.
Choose those permissions are rational
- RationaleData
It's adata class
used as choose which permission or permissions to display rationale view.
And what kind of message will be displayed in your rational view.
example: