Skip to content

Latest commit

 

History

History
61 lines (46 loc) · 1.41 KB

adal-permissions.md

File metadata and controls

61 lines (46 loc) · 1.41 KB

adal-permissions

Android library that simplifies the request of permissions at runtime.

Download

Gradle:

dependencies {
  implementation 'com.massivedisaster.adal:adal-permissions:0.1.20'
}

Usage

public class FragmentPermissions extends BaseFragment {

    private PermissionsManager mPermissionsManager;

    @Override
    protected void doOnCreated() {
      
        mPermissionsManager = new PermissionsManager(this);

        requestPermissions();
    }

    private void requestPermissions() {
        mPermissionsManager.requestPermissions(new PermissionsManager.OnPermissionsListener() {
            @Override
            public void onGranted() {
                // Granted.
            }

            @Override
            public void onDenied(boolean neverAskMeAgain) {
                // Denied.

                if (neverAskMeAgain) {
                    // User clicked nerver ask me again.
                }
            }
        }, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.WRITE_CALENDAR);
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        mPermissionsManager.onPermissionResult(requestCode);
    }
}

Contributing

CONTRIBUTING

License

MIT LICENSE