advancedPermissionHandler

Additional

Language
Java
Version
N/A
Created
Nov 20, 2017
Updated
Nov 28, 2017
Owner
Mahdi Tajik (mahdit83)
Contributor
Mahdi Tajik (mahdit83)
1
Activity
Badge
Generate
Download
Source code
APK file

Advertisement

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 .

Just inherit your desired Activity from advancedPermissionHandlerActivity 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               

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