Easier to use Android runtime permissions with LiveData

Dependency

Implementation 'com. Werb. Azure: azure: 0.1.0 from' implementation 'android. Arch. Lifecycle: extensions: 1.1.1'Copy the code

Use

Azure(this)
    .permissions(Manifest.permission.READ_EXTERNAL_STORAGE,Manifest.permission.WRITE_EXTERNAL_STORAGE)
    .subscribe {
        if (it) {
            // do something when permission isGranted
        } else {
            // do something when permission isDenied
        }
    }.request()Copy the code