Android Library to help you with your runtime Permissions.


Android M Watch it in action.
Pre M Watch it in action.

Nexus 6 (M)

Nexus 6

Nexus 7 (L)


Nexus 10 (L)




    compile 'com.github.k0shk0sh:PermissionHelper:1.0.13'




Ask Permissions in Style

Have you wondered what will give you a higher chance of letting the user accepts your permission?

The answer is simple: (Educating UI) that explains why you need to use that particular permission.


You still can use the library to explain why you used the permission in your app, the library will never try ask the permission if Android is smaller than M, it will just do like any Intro library does. as you can see in Nexus 7 & Nexus 10 screens running Android L, request button is hidden ;).

For Better Understanding, please have a look at the example code at SamplePagerActivity

Take Control.

Your Activity/Presenter should implement OnPermissionCallback which in return will give you access to

    void onPermissionGranted(String[] permissionName);

    void onPermissionDeclined(String[] permissionName);

    void onPermissionPreGranted(String permissionsName);

    void onPermissionNeedExplanation(String permissionName);  

    void onPermissionReallyDeclined(String permissionName);//user has ticked don't show again and deny the permission

    void onNoPermissionNeeded(); // fallback to api < M

to request a permission all you have to do is:

     .setForceAccepting(false)// true if you had like force reshowing the permission dialog on Deny (not recommended)

and finally in your Activity





public static String declinedPermission(@NonNull Context context, @NonNull String[])
public static String[] declinedPermissions(@NonNull Context context, @NonNull String[] permissions)
public static boolean isPermissionGranted(@NonNull Context context, @NonNull String permission)
public static boolean isPermissionDeclined(@NonNull Context context, @NonNull String permission)
public static boolean isExplanationNeeded(@NonNull Activity context, @NonNull String permissionName)
public static boolean permissionExists(@NonNull Context context, @NonNull String permissionName)
public static boolean isPermissionPermanentlyDenied(@NonNull Activity context, @NonNull String permission)
public static void openSettingsScreen(Context context)//useful when we can't request for the permission due to user ticked don't show again.
public static boolean isSystemAlertGranted(@NonNull Context context)// special case for SYSTEM_ALERT_WINDOW permission.
public void requestAfterExplanation(String permissionName)// to be used if the permission needs explanation
public void requestAfterExplanation(String[] permissions)//to be used if the permission needs explanation
public void requestSystemAlertPermission() // not really needed as request(...) will handle this case.
> all of the above static methods you can still access them with PermissionHelper instance.

To understand more how taking control would look like please go through the sample app

Why this library?


Android Support library `v24.0.2

CirclePageIndicator by JakeWharton (integrated within the library).


Images used inside the demo are by Maximilian Keppeler

Copyright Notice

Copyright (C) 2015 Kosh. Licensed under the Apache 2.0 license (see the LICENSE file).