[英]Download PDF from a URL in Downloads folder on android app with targetSdkVersion=30
I want to download a pdf from a url on Android>=11.我想在 Android>=11 上从 url 下载 pdf。 My app is targeting android version 30.
我的应用程序的目标是 android 版本 30。
I read that due to restrictions introduced from Android 11, it does not easily allow us to store files in external Downloads folder and we have to store it inside Android/package_name/[folder]/[file], but I want to store it in Downloads folder so that my user does not have to go inside Android/package/[Downloads]/[file] to view that file.我读到由于 Android 11 引入的限制,它不容易让我们将文件存储在外部下载文件夹中,我们必须将其存储在 Android/package_name/[folder]/[file] 中,但我想将其存储在下载文件夹,这样我的用户就不必在 Android/package/[Downloads]/[file] 中的 go 来查看该文件。
Also on devices which are running Android<11, I can download that file by simply using getExternalStorageDirectory right?同样在运行 Android<11 的设备上,我可以通过简单地使用 getExternalStorageDirectory 来下载该文件,对吗? Please provide me some clarity on this.
请给我一些澄清。
I found some answers previously but they weren't that helpful.我之前找到了一些答案,但它们并没有那么有帮助。 Can anybody tell me how to achieve this?
谁能告诉我如何实现这一目标?
In Android 10ff it is not easy to use the java class "File" to store data in a public accessable folder that is pre-defined by your app.(ie the public download folder)在 Android 10ff 中,使用 java class “文件”将数据存储在您的应用程序预定义的公共可访问文件夹中并不容易。(即)
Instead your app has to ask the app-user where he/she wants to store the document .相反,您的应用程序必须询问应用程序用户他/她想要将文档存储在哪里。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.