novoda / download-manager

A library that handles long-running downloads, handling the network interactions and retrying downloads automatically after failures
Apache License 2.0
483 stars 63 forks source link

SAF (Storage Access Framework) support #449

Closed proninyaroslav closed 5 years ago

proninyaroslav commented 5 years ago

This is important for downloading to the SD card on Android 4.4 and higher.

Mecharyry commented 5 years ago

Hi @proninyaroslav as far as I know we do not currently support the Storage Access Framework. Am I right in thinking that this is used for browsing and viewing documents? If you could provide links to any supporting documentation and provide us with a usecase, it will be considerably easier for us to answer your question / request. Thanks!

proninyaroslav commented 5 years ago

This is a file access technology through a provider. This is the only way to write a file to external storage without knowing the absolute path(for >= 4.4). A provider provides a certain path to the storage but hides all the details of working with it, including the absolute path in file system. You can read about this https://developer.android.com/guide/topics/providers/document-provider

Mecharyry commented 5 years ago

Hi @proninyaroslav I see. I'm not sure I see what benefit this brings except to remove the need for absolute paths, something that can be done without needing to introduce the use of the Storage Access Framework. I see in the docs it is used for connecting to a variety of storage mediums, such as google drive and USB storage.

Do you have a specific usecase in mind, or is it just the absolute path you wish to see removed?

proninyaroslav commented 5 years ago

Please read this and you will understand why it is important https://stackoverflow.com/questions/43066117/android-m-write-to-sd-card-permission-denied

Mecharyry commented 5 years ago

Hi @proninyaroslav I've taken a look at the issue you have linked. From what I have read this would only be an issue if you were trying to save the downloaded file to an SD card that wasn't part of the app path. If you were not using https://developer.android.com/reference/android/support/v4/content/ContextCompat#getExternalFilesDirs(android.content.Context,%20java.lang.String)

The primary purpose of this library is to always download into a path that your app controls. If you think I have misunderstood anything please get back in touch.

proninyaroslav commented 5 years ago

Thank you.