Skip to content

Commit 629ba83

Browse files
committed
Fix: Use ACTION_GET_CONTENT instead of ACTION_OPEN_DOCUMENT for file picking
This change modifies the `startFileExplorer` function to use `Intent.ACTION_GET_CONTENT` instead of `Intent.ACTION_OPEN_DOCUMENT`. This resolves an issue where `ACTION_OPEN_DOCUMENT`, combined with `Intent.CATEGORY_OPENABLE`, could lead to hangs or crashes when picking files from certain providers like Google Drive, OneDrive, or Dropbox, especially when the files are not available locally on the device. `ACTION_GET_CONTENT` is more suitable for importing a copy of the data.
1 parent ed5206e commit 629ba83

File tree

1 file changed

+1
-1
lines changed
  • android/src/main/kotlin/com/mr/flutter/plugin/filepicker

1 file changed

+1
-1
lines changed

android/src/main/kotlin/com/mr/flutter/plugin/filepicker/FileUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ object FileUtils {
159159
intent.putExtra(Intent.EXTRA_MIME_TYPES, allowedExtensions)
160160
}
161161
} else {
162-
intent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
162+
intent = Intent(Intent.ACTION_GET_CONTENT).apply {
163163
addCategory(Intent.CATEGORY_OPENABLE)
164164
type = this@startFileExplorer.type
165165
if (!allowedExtensions.isNullOrEmpty()) {

0 commit comments

Comments
 (0)