Request single or multiple permissions in activity or fragment at run time without any hassles.
allprojects {
repositories {
jcenter()
}
}
implementation 'com.techhelper.permission.handler:AndroidPermissionHandler:1.0.0'
class BaseActivity extends PermissionHandlerBaseAppCompatActivity{
}
requestWriteStoragePermission(STORAGE_PERMISSION_CODE, new PermissionResultListener() {
@Override
public void onAllPermissionsGranted(int requestCode, String[] permissions, int[] grantResults) {
// Now permission is granted. Do your task here.
}
@Override
public void onPermissionDenied(int requestCode, String[] permissions, int[] grantResults) {
// Permission is denied. Check for denied permission and show relevant message to the user.
}
});
String[] permissions = new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA};
requestListOfPermissions(permissions, STORAGE_CAMERA_PERMISSION_CODE, new PermissionResultListener() {
@Override
public void onAllPermissionsGranted(int requestCode, String[] permissions, int[] grantResults) {
// Now all permissions are granted. Do your task here.
}
@Override
public void onPermissionDenied(int requestCode, String[] permissions, int[] grantResults) {
// Few or all permissions are denied. Check for denied permissions and show relevant message to the user.
}
});
class SignUpActivity implements PermissionHandlerConstants{
}
Please feel free to contribute by following standard process of reviewing pull requests and other git commands.
This project is licensed under the [Apache-2.0] - see the LICENSE file for details
