Read the quick documentation, Javadoc or go to the source code.
All functions annotated by @WorkerThread
must be called in the background thread,
otherwise @UiThread
must be called in the main thread.
If you ignore the annotation, your apps will lead to ANR.
Use keyboard shortcut Control + Q on Windows or Control + J on MacOS. More shortcuts can be found on Android Studio keyboard shortcuts.
No runtime permission is required to be prompted on scoped storage.
Read the input stream with extension function openInputStream()
and upload it as Base64 text.
Getting file path (getAbsolutePath()
, getBasePath()
, etc.) may returns empty string if the DocumentFile
is instance of androidx.documentfile.provider.SingleDocumentFile
.
You you can convert it to MediaFile
and use MediaFile.absolutePath
. If this still does not work, then there's no other way.
Use isWritable()
extension function, because DocumentFile.canWrite()
sometimes buggy on API 30.
Use branch release/*
if exists, or use master
instead.