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