Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/369.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在使用应用程序路径存储之前请求权限_Java_Android_Permissions_Storage - Fatal编程技术网

Java 在使用应用程序路径存储之前请求权限

Java 在使用应用程序路径存储之前请求权限,java,android,permissions,storage,Java,Android,Permissions,Storage,我的应用程序使用内部\外部存储上的应用程序文件夹读取\写入文件,我通过以下代码获取路径 ContextCompat.getExternalFilesDirs(getAppContext(),null); 我的目标是SDK版本30,最低SDK版本19,如下所示 compileSdkVersion 30 buildToolsVersion '30.0.3' compileOptions { encoding = 'utf-8' sourceCompatibility JavaVe

我的应用程序使用内部\外部存储上的应用程序文件夹读取\写入文件,我通过以下代码获取路径

ContextCompat.getExternalFilesDirs(getAppContext(),null);
我的目标是SDK版本30,最低SDK版本19,如下所示

 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
}
我的问题:在使用下面的应用程序路径存储之前是否需要请求权限

     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);
非常感谢

在使用下面的应用程序路径存储之前是否需要请求权限

     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);
对于
getExternalFilesDirs()
,您不需要请求任何运行时权限