Skip to content

Latest commit

 

History

History
72 lines (51 loc) · 2.58 KB

README.md

File metadata and controls

72 lines (51 loc) · 2.58 KB

Release Build Status codebeat badge API License: MIT Maintainer: kidal5 Qase: PermissionManager

PermissionManager

Smart android runtime permission manager written in kotlin language.

Mostly used and tested in Prague based android develpoment company - Quanti.

Do not use it right now. There might be bugs inside because of new android versions.

Features

  • Usable in every JVM language including Java/Kotlin/Scala ...
  • Very easy to use
  • Lightweight
  • Sample app is ready to build

Cons

  • Need static access to activity

Code Example

Usage is simple

  1. Add all your desired permissions to manifest
<manifest ...>
    <uses-permission android:name="android.permission.READ_CALENDAR"/>
    <uses-permission android:name="android.permission.SEND_SMS"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    
    ...
    
</manifest>
  1. Add some code to your static activity
 override fun onCreate(savedInstanceState: Bundle?) {
       BasePermission.setActivity(this)
 }
    
 override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
       BasePermission.propagatePermissionResult(requestCode, permissions, grantResults)
 }
  1. Then select appropriate instance based on permission class and ask for permission or check status
 if (ContactsPermission.permissionState == DECLINED){
       ContactsPermission.requestPermission(this)
 }
                
 if (ContactsPermission.permissionGranted())

Installation

Follow this STEPS.

Future development

  • send your requests

License

MIT