[英]How to save a file in the external storage on Android 13 that is also backward compatible?
I want to find an updated answer that works from android 5/6/7 to 13 with less possible permission.我想找到一个更新的答案,它可以在 android 5/6/7 到 13 的情况下使用,但许可较少。 I know there are answers like Android saving file to external storage storage but those are very old.我知道有类似Android 将文件保存到外部存储的答案,但这些答案已经很老了。
You can understand accessing and storing files on android better from the google's official documentation here , mainly app-specific storage vs permission requirement, ie if you want to save file which are app specific, you won't need permission whether it being internal or external storage, but if you want to access locations which are not your app-specific, you will need permission for both internal and external storage.您可以从这里的谷歌官方文档中更好地了解在 android 上访问和存储文件,主要是特定于应用程序的存储与权限要求,即如果您想保存特定于应用程序的文件,则无论是内部还是外部都不需要权限存储,但如果您想访问非特定于您的应用程序的位置,您将需要内部和外部存储的权限。
Also, this behavior of permission requirement has been adopted after a particular API level, so you can start writing you code as per your targetSdk
version and keep including options down to your minSdk
versions and have a common method for permission for reusing it wherever is required.此外,这种权限要求行为在特定的 API 级别之后已被采用,因此您可以根据您的targetSdk
版本开始编写代码,并继续将选项包含到您的minSdk
版本中,并有一个通用的权限方法可以在需要的地方重用它.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.