Offer foreground download to user with possible di

2019-07-11 19:19发布

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条回答
冷血范
2楼-- · 2019-07-11 20:09

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.

查看更多
登录 后发表回答