我有一个使用以下权限的应用:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
我正在构建适用于 Android 6.0 的应用:
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "de.my.package"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
当我现在启动应用程序并写入外部存储时,即使我没有设置权限,我也不会被要求获得使用 Android 6.0 的 Nexus 5 的权限:
App 为什么以及如何在未经许可的情况下写入外部存储?
最佳答案
Starting in Build.VERSION_CODES.KITKAT, no permissions are required to read or write to the returned path; it's always accessible to the calling app. This only applies to paths generated for package name of the calling application. To access paths belonging to other packages, Manifest.permission.WRITE_EXTERNAL_STORAGE and/or Manifest.permission.READ_EXTERNAL_STORAGE are required.
你可以看到文档 here
关于android - 应用程序未经许可写入外部存储,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37522602/