public void requestInternetPermission() { if (ActivityCompat.shouldShowRequestPermissionRationale( activity, Manifest.permission.INTERNET)) { permissionCallback.onPermissionExplanationRequired(true, Manifest.permission.INTERNET); } else { ActivityCompat.requestPermissions( activity, new String[] {Manifest.permission.INTERNET}, INTERNET_PERMISSION); } }
public void requestExternalStoragePermission() { if (ActivityCompat.shouldShowRequestPermissionRationale( activity, Manifest.permission.WRITE_EXTERNAL_STORAGE)) { permissionCallback.onPermissionExplanationRequired( true, Manifest.permission.WRITE_EXTERNAL_STORAGE); } else { ActivityCompat.requestPermissions( activity, new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, EXTERNAL_STORAGE_PERMISSION); } }
public void requestExternalStoragePermission( AppCompatActivity appCompatActivity, PermissionCallback callback, boolean requestFromDialog) { if (ActivityCompat.shouldShowRequestPermissionRationale( appCompatActivity, Manifest.permission.WRITE_EXTERNAL_STORAGE) && !requestFromDialog) { callback.onPermissionExplanationRequired(true, Manifest.permission.WRITE_EXTERNAL_STORAGE); } else { ActivityCompat.requestPermissions( appCompatActivity, new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, EXTERNAL_STORAGE_PERMISSION); } }