Offer foreground download to user with possible dialog

落爺英雄遲暮 提交于 2019-12-12 18:06:11

问题


I'm fighting with usability design.

Let's have application which has only one permission, android.permission.INTERNET.

I want to download image from remote URL (where I cannot control server-side), but download it so user can choose whether and where download that file.
Displaying dialog for process approval and/or choosing final destination.

I have considered these solutions:

  • DownloadManager using setDestinationInExternalPublicDir
    • Two bugs, I don't want to add WRITE_EXTERNAL_STORAGE permission, and user cannot decide whether to download or not
  • Using Intent.ACTION_VIEW to launch browser
    • standalone will display image to user, but not initiate download automatically
  • Using Intent.ACTION_VIEW and custom proxy script
    • Server is not mine, and I don't want to provide my server-side proxy download forcing script
  • Replacing HTTP(S) for FTP, and let user decide
    • Does not work, as images on that server are not available through FTP
  • Providin compatibility for download applications (such as "Download All Files", various "File Managers", ...)

How to achieve this without expanding current permissions or depend on non-standard app?


Linked to this github issue https://github.com/smarek/Simple-Dilbert/issues/1


回答1:


Your App downloads files and potentially writes them to the external storage. I feel you should be requesting the WRITE_EXTERNAL_STORAGE (which implies also READ_EXTERNAL_STORAGE) permission, to accurately represent what it is your App does.

Then your first solution works. You just need any method of prompting the user before making the download call. Or otherwise make active acceptance part of your work flow.



来源:https://stackoverflow.com/questions/16210894/offer-foreground-download-to-user-with-possible-dialog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!