2.3.0-rc1
- CL-15257 File access using Uris instead of absolute file paths.
Major changes:
FileItem
: the attrlocalPath
contains a valid absolute path if onlyofflineStatus == AVAILABLE
. In other cases a path might be invalid or inaccessible for the app.DownloaderEvent
: breaking change: the attrdestPath
was removed.OperationDownload
: breaking change: the attrdestination
was removed.FileDownloader
:Breaking change: the static method
checkSelfPermissions()
was removed because the way how permissions should be checked depends on how a file is enqueued for downloading.The new method
enqueueFile()
was added that acceptsUri
as a target directory specification. If your app has write access to local storage you can call old method (which accepts absolute paths), but if scoped storage restrictions (as of Android 10+) are applied to your app, you should use SAF-provided Uris.Downloading of a file to a directory, specified by an absolute path is possible if the app has the
android.permission.WRITE_EXTERNAL_STORAGE
permission and has opted-out from scoped storage restrictions as of Android 10+. In other cases the app should use SAF-provided Uri. Otherwise downloading will fail.
FileUploader
:- The new methods
enqueueFile()
were added which acceptUri
as a source file specification. If your app has read access to local storage you can call old methods (which accepts absolute file paths), but if scoped storage restrictions (as of Android 10+) are applied to your app, you should use SAF-provided Uris. Otherwise uploading will fail. - When the app passes source file for uploader as
Uri
, theenqueueFile()
method takes 'persistable uri permission' for givenUri
and releases it when a file either: successfully uploaded, cancelled or failed to read.
- The new methods