Fetch icon indicating copy to clipboard operation
Fetch copied to clipboard

Issues with Storage Access Framework

Open DavidKmn opened this issue 4 years ago • 3 comments

I am trying to integrate fetch to work with the Storage Access Framework. Decided to use https://github.com/anggrayudi/SimpleStorage which simplifies the use. Using it however an error of UNKNOWN_IO_ERROR keeps getting thrown. How can we use Fetch to support SAF, am I missing something?

DavidKmn avatar Jan 14 '21 11:01 DavidKmn

Fetch uses java.io.File, I will assume that it does not support scoped storage yet. Or does Fetch to have scoped storage support for API 29+?

DavidKmn avatar Jan 14 '21 19:01 DavidKmn

@DavidKmn thanks for using Fetch. By default Fetch uses the java.io.File and simple SAF via the DefaultStorageResolver.

You can provide Fetch with your own StorageResolver to handle creating, renaming, deleting, and storing data. Eg:

    final FetchConfiguration fetchConfiguration = new FetchConfiguration.Builder(this)
                .enableRetryOnNetworkGain(true)
                .setDownloadConcurrentLimit(3)
                .setStorageResolver(new MyStorageResolver(context))
                .build()
Fetch.Impl.setDefaultInstanceConfiguration(fetchConfiguration);

Take a look at the StorageResolver Java docs for more information.

tonyofrancis avatar Jan 30 '21 19:01 tonyofrancis

Thanks for the help @tonyofrancis. Love the library 👍

DavidKmn avatar Feb 01 '21 15:02 DavidKmn