Skip to content

Commit c82f7fe

Browse files
Document that native file dialog is only available on Android 10+ devices.
1 parent 9a39760 commit c82f7fe

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

doc/classes/DisplayServer.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@
782782
Displays OS native dialog for selecting files or directories in the file system.
783783
Each filter string in the [param filters] array should be formatted like this: [code]*.png,*.jpg,*.jpeg;Image Files;image/png,image/jpeg[/code]. The description text of the filter is optional and can be omitted. It is recommended to set both file extension and MIME type. See also [member FileDialog.filters].
784784
Callbacks have the following arguments: [code]status: bool, selected_paths: PackedStringArray, selected_filter_index: int[/code]. [b]On Android,[/b] the third callback argument ([code]selected_filter_index[/code]) is always [code]0[/code].
785-
[b]Note:[/b] This method is implemented if the display server has the [constant FEATURE_NATIVE_DIALOG_FILE] feature. Supported platforms include Linux (X11/Wayland), Windows, macOS, and Android.
785+
[b]Note:[/b] This method is implemented if the display server has the [constant FEATURE_NATIVE_DIALOG_FILE] feature. Supported platforms include Linux (X11/Wayland), Windows, macOS, and Android (API level 29+).
786786
[b]Note:[/b] [param current_directory] might be ignored.
787787
[b]Note:[/b] Embedded file dialog and Windows file dialog support only file extensions, while Android, Linux, and macOS file dialogs also support MIME types.
788788
[b]Note:[/b] On Android and Linux, [param show_hidden] is ignored.

doc/classes/FileDialog.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
<member name="title" type="String" setter="set_title" getter="get_title" overrides="Window" default="&quot;Save a File&quot;" />
206206
<member name="use_native_dialog" type="bool" setter="set_use_native_dialog" getter="get_use_native_dialog" default="false">
207207
If [code]true[/code], and if supported by the current [DisplayServer], OS native dialog will be used instead of custom one.
208-
[b]Note:[/b] On Android, it is only supported when using [constant ACCESS_FILESYSTEM]. For access mode [constant ACCESS_RESOURCES] and [constant ACCESS_USERDATA], the system will fall back to custom FileDialog.
208+
[b]Note:[/b] On Android, it is only supported for Android 10+ devices and when using [constant ACCESS_FILESYSTEM]. For access mode [constant ACCESS_RESOURCES] and [constant ACCESS_USERDATA], the system will fall back to custom FileDialog.
209209
[b]Note:[/b] On Linux and macOS, sandboxed apps always use native dialogs to access the host file system.
210210
[b]Note:[/b] On macOS, sandboxed apps will save security-scoped bookmarks to retain access to the opened folders across multiple sessions. Use [method OS.get_granted_permissions] to get a list of saved bookmarks.
211211
[b]Note:[/b] Native dialogs are isolated from the base process, file dialog properties can't be modified once the dialog is shown.

platform/android/display_server_android.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ bool DisplayServerAndroid::has_feature(Feature p_feature) const {
6363
return (native_menu && native_menu->has_feature(NativeMenu::FEATURE_GLOBAL_MENU));
6464
} break;
6565
#endif
66+
case FEATURE_NATIVE_DIALOG_FILE: {
67+
String sdk_version = OS::get_singleton()->get_version().get_slicec('.', 0);
68+
return sdk_version.to_int() >= 29;
69+
} break;
70+
6671
case FEATURE_CURSOR_SHAPE:
6772
//case FEATURE_CUSTOM_CURSOR_SHAPE:
6873
//case FEATURE_HIDPI:
@@ -72,7 +77,6 @@ bool DisplayServerAndroid::has_feature(Feature p_feature) const {
7277
//case FEATURE_MOUSE_WARP:
7378
case FEATURE_NATIVE_DIALOG:
7479
case FEATURE_NATIVE_DIALOG_INPUT:
75-
case FEATURE_NATIVE_DIALOG_FILE:
7680
//case FEATURE_NATIVE_DIALOG_FILE_EXTRA:
7781
case FEATURE_NATIVE_DIALOG_FILE_MIME:
7882
//case FEATURE_NATIVE_ICON:

0 commit comments

Comments
 (0)