简体   繁体   English

android,directory_downloads 中的下载文件是否需要危险权限?

[英]android, download file in directory_downloads need dangerous permission or not?

i use asyncTask to download apk file in to:我使用asyncTask将 apk 文件下载到:

Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)

now, this need dangerous permission or not?现在,这是否需要dangerous permission and where is granted location for write file without dangerous permission need?没有dangerous permission需要在哪里授予写入文件的位置? thanks谢谢

According to the Android Documentation you can use normal permissions:根据Android 文档,您可以使用普通权限:

Normal permissions cover areas where your app needs to access data or resources outside the app's sandbox, but where there's very little risk to the user's privacy or the operation of other apps.普通权限涵盖您的应用程序需要访问应用程序沙箱外的数据或资源的区域,但对用户隐私或其他应用程序的操作风险很小的区域。 For example, permission to set the time zone is a normal permission.比如设置时区的权限就是普通权限。 If an app declares that it needs a normal permission, the system automatically grants the permission to the app.如果应用程序声明需要普通权限,系统会自动授予该应用程序权限。 For a full listing of the current normal permissions, see Normal permissions.有关当前普通权限的完整列表,请参阅普通权限。

More specifically, you need to use Write Permission in order to write on Internal/External storage.更具体地说,您需要使用写入权限才能在内部/外部存储上写入。 You can add the following on your manifest file to get write permissions on the Downloads folder:您可以在清单文件中添加以下内容以获得对下载文件夹的写入权限:

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

I also recommend reading the official documentation for more info.我还建议阅读官方文档以获取更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM