Код: Выделить всё
Dexter.withContext(this)
.withPermission(Manifest.permission.READ_EXTERNAL_STORAGE)
.withListener(new PermissionListener() {
@Override
public void onPermissionGranted(PermissionGrantedResponse permissionGrantedResponse) {
Toast.makeText(MainActivity.this, "Permission Granted", Toast.LENGTH_SHORT).show();
}
@Override
public void onPermissionDenied(PermissionDeniedResponse permissionDeniedResponse) {
Toast.makeText(MainActivity.this, "Permission Denied", Toast.LENGTH_SHORT).show();
}
@Override
public void onPermissionRationaleShouldBeShown(PermissionRequest permissionRequest, PermissionToken permissionToken) {
Toast.makeText(MainActivity.this, "Permission Rationale Should Be Shown", Toast.LENGTH_SHORT).show();
}
})
.check();
Код: Выделить всё
Код: Выделить всё
implementation 'com.karumi:dexter:6.2.2'
Подробнее здесь: https://stackoverflow.com/questions/787 ... ndroid-app