gpt4 book ai didi

android - 我是否需要在 Android 4.1 及更早版本上明确声明 WRITE_EXTERNAL_STORAGE 权限?

转载 作者:太空狗 更新时间:2023-10-29 16:28:34 26 4
gpt4 key购买 nike

关于 WRITE_EXTERNAL_STORAGE,Android 文档指出

Starting in API level 19, this permission is not required to read/write files in your application-specific directories returned by getExternalFilesDir(String) and getExternalCacheDir().

我的应用程序只读取和写入 Android/data//files 目录。这是否意味着,只要我的应用在早于 19 的 Android 版本上运行,为了读取和写入此特定目录,我仍然需要在 list 中声明此权限?

最佳答案

Android 文档说 here :

Beginning with Android 4.4, reading or writing files in your app's private directories does not require the READ_EXTERNAL_STORAGE or WRITE_EXTERNAL_STORAGE permissions. So you can declare the permission should be requested only on the lower versions of Android by adding the maxSdkVersion attribute:

<manifest ...>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
...
</manifest>

所以答案显然是

关于android - 我是否需要在 Android 4.1 及更早版本上明确声明 WRITE_EXTERNAL_STORAGE 权限?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44477827/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com