【发布时间】:2021-09-01 12:00:28
【问题描述】:
有人解决了我的代码
private fun isFileExists(): Boolean {
var checked = false
try {
val filePath= this.applicationInfo.dataDir + PATH_SUFFIX + FILE_NAME
val file = File(filePath)
if (file.exists()) {
checked = true
}
} catch (ignored: Exception) {
}
return checked
}
Bellow android Q 如果存在则返回true,但在Q之上它总是返回false
【问题讨论】:
-
在 Android 10 及更高版本上,您无权访问其他应用的外部存储部分。
-
是的,我知道,但是,我想找到我自己的应用程序 this.applicationInfo.dataDir
-
请告知完整路径。告诉 fullPath 的值。我们应该怎么知道?
标签: android performance android-fragments scoped-storage