Request permission before using the app path storage

Viewed 30

My application using the application folder on internal \ External storage to read \ write files, I am getting the path by this code

ContextCompat.getExternalFilesDirs(getAppContext(),null);

I am targeting SDK Version 30, and minimum SDK version 19 as below

 compileSdkVersion 30
buildToolsVersion '30.0.3'
compileOptions {
    encoding = 'utf-8'
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
    applicationId "com.****.****"
    minSdkVersion 19
    targetSdkVersion 30
    versionCode 82
    versionName "4.0.1"
    multiDexEnabled true
}

My Question: Is it necessary to request permission before using the app path storage as below?

     private static final String[] PERMS_TAKE_PICTURE = {
        INTERNET,
        WRITE_EXTERNAL_STORAGE,
        ACCESS_NETWORK_STATE,
        ACCESS_WIFI_STATE,
        READ_EXTERNAL_STORAGE,
        RECEIVE_BOOT_COMPLETED,
        WAKE_LOCK,
    };
    ActivityCompat.requestPermissions(this,
            PERMS_TAKE_PICTURE,
            MY_PERMISSIONS_REQUEST);

Thanks a lot

1 Answers

Is it necessary to request permission before using the app path storage as below?

For getExternalFilesDirs(), you do not need to request any runtime permissions.

Related