Skip to content

mahdit83/advancedPermissionHandler

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
app
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

Releases

No releases published

Packages

No packages published

Languages