Godot plugin to display a native Android date and time picker control
To use this plugin you will need to compile it against your required version of Godot.
You will need:
- Android Studio https://developer.android.com/studio
- Godot AAR Library for your desired version https://godotengine.org/download/
- Open the project in Android Studio
- Put your downloaded Godot AAR Library into the
app/libs
directory. (Ensure its filename matchesgodot-lib*.aar
)
- Compile the project
- Copy the
app/build/outputs/aar/DateTimePickerPlugin.aar
file and theapp/DateTimePickerPlugin.gdap
file to theandroid/plugins
folder into your Godot app directory.
- Go to Project -> Export, select the android export, check custom build, and enable the plugin.
extends Node2D
var dateTimePickerPlugin
func _ready():
# Load The plugin
dateTimePickerPlugin = Engine.get_singleton("DateTimePickerPlugin")
# Connect to the response signal
dateTimePickerPlugin.connect("onDateTimePicked", self, "on_DateTimePicked")
# Show the dateTime picker for reference "onready"
dateTimePickerPlugin.showDateTimePicker("onReady")
func on_DateTimePicked(reference : String, data : Dictionary):
# Print the reference, response object and formated date time for each request
# onReady {day:12, hour:23, minute:54, month:12, year:2022} 2022-12-12 23:54:00
# buttonPressed {day:16, hour:5, minute:20, month:11, year:2025} 2025-11-16 05:20:00
print(reference, data, Time.get_datetime_string_from_datetime_dict(data, true))
func _on_Button_pressed():
# Show the dateTime picker for reference "buttonPressed"
dateTimePickerPlugin.showDateTimePicker("buttonPressed")