Using PermissionUtil

suggest change

PermissionUtil is a simple and convenient way of asking for permissions in context. You can easily provide what should happen in case of all requested permissions granted (onAllGranted()), any request was denied (onAnyDenied()) or in case that a rational is needed (onRational()).

Anywhere in your AppCompatActivity or Fragment that you want to ask for user’s permisssion

mRequestObject = PermissionUtil.with(this).request(Manifest.permission.WRITE_EXTERNAL_STORAGE).onAllGranted(
                new Func() {
                    @Override protected void call() {
                        //Happy Path
                new Func() {
                    @Override protected void call() {
                        //Sad Path

And add this to onRequestPermissionsResult

    mRequestObject.onRequestPermissionsResult(requestCode, permissions, grantResults);

Add the requested permission to your AndroidManifest.xml as well

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents