问题
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
- Two bugs, I don't want to add
- 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