Skip to content

MauriceButler/godot-date-time-picker-plugin-android

Repository files navigation

godot-date-time-picker-plugin-android

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.

Compile

You will need:

  1. Open the project in Android Studio
  2. Put your downloaded Godot AAR Library into the app/libs directory. (Ensure its filename matches godot-lib*.aar)

image

  1. Compile the project

Install Plugin

  1. Copy the app/build/outputs/aar/DateTimePickerPlugin.aar file and the app/DateTimePickerPlugin.gdap file to the android/plugins folder into your Godot app directory.

image

  1. Go to Project -> Export, select the android export, check custom build, and enable the plugin.

image

Use the control

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")

demo gif

About

Godot plugin to display a native Android date and time picker control

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages