This Android library is for handle running time permissions in simplest way!
Switch branches/tags
Clone or download
Latest commit 0068c2b Jan 4, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
advancedPermissionsHandler Update methods Nov 21, 2017
app Update methods Nov 21, 2017
gradle/wrapper Initial commit Nov 20, 2017
.gitignore Update methods Nov 21, 2017
LICENSE.txt Create LICENSE.txt Nov 23, 2017
README.md Update README.md Jan 4, 2018
build.gradle Change package name Nov 20, 2017
gradle.properties Initial commit Nov 20, 2017
gradlew Initial commit Nov 20, 2017
gradlew.bat Initial commit Nov 20, 2017
settings.gradle Change package name Nov 20, 2017

README.md

Advanced Permission Handler

This library have an abstact Activty, advancedPermissionHandlerActivity is that handle all permission stuff, pice of cake. Main idea is from my dear friend Ali Nemati hayati.

Just inherit your desired Activity from PermissionHandlerActivity and simply call one of askForPermission() methods which one with auto-generate message ability for your given permissions (works for Farsi right now) and one with your custom message.

String[] permissions = new String[] {Manifest.permission.SEND_SMS, 
Manifest.permission.WRITE_EXTERNAL_STORAGE , Manifest.permission.READ_EXTERNAL_STORAGE , ...}

boolean stickyMode = true;

askForPermission(permissions , stickyMode, new PermissionCallBack() {
                    
                    @Override
                    public void onPermissionsGranted() {  
                        Log.i("mahdi", "onPermissionsGranted: ");
                    }

                    @Override
                    public void onPermissionsDenied(String[] permissions) {
                        Log.i("mahdi", "onPermissionsDenied: ");
                    }
                });

These are steps:

  1. First ask for all permissions.
  2. Then try to aks for ungranted-permissions with custom message again from user.
  3. Then try to open settings for permissions if user set 'Don't ask again'
  4. Finaly if user deny, onPermissionsDenied callback will triggers.

Sticky mode specifies that, if all these four steps happen in one session or not.

For using advancedPermissionHandler add this line to gradle:

compile 'ir.mtajik.android:advancedPermissionsHandler:1.0.2               

Mahdi Tajik

my weblog: http://www.mahditajik.ir