This plugin worked for Godot 3, using the old plugin API and is now archived. For Godot 4 use this one: https://github.com/cengiz-pz/godot-android-notification-scheduler-plugin
An Android plugin for Godot 3 to send Android notifications
This plugin implements https://developer.android.com/guide/topics/ui/notifiers/notifications for Godot Engine.
create a icon_notification.png
within the android resources in your godot project:
android/build/res/mimap/icon_notification.png
Prerequisites:
- Android SDK (platform version 30)
- the Godot Android library (
godot-lib.***.release.aar
) for your version of Godot from the downloads page.
Steps to build:
- Clone this Git repository
- Put
godot-lib.***.release.aar
in./godot-android-notifications/libs/
- Run
./gradlew build
in the cloned repository
If the build succeeds, you can find the resulting .aar
files in ./godot-android-notifications/build/outputs/aar/
.
Copy this .aar
and GodotAndroidNotifications.gdap
in your godot project, into:
android/plugins/.
You should get something like:
android/plugins
├── GodotAndroidNotifications.1.0.0.release.aar
├── GodotAndroidNotifications.gdap
Now export your Godot project using the custom build
You have 2 functions available on godot side
var notifier = Engine.get_singleton('GodotAndroidNotifications')
var notificationId = 'whatever, I use time stuff to get unique ids'
notifier.schedule(
'the title',
'the message',
secsToNextNotification,
notificationId
)
You can store your notificationId
anywhere, and use it to cancel the scheduling:
notifier.cancel(notificationId)
- inspiration from: https://github.com/DrMoriarty/godot-local-notification/blob/master/android-plugin/
- reference plugin implementation : https://github.com/godotengine/godot-google-play-billing
- docs to create a plugin from godot: https://docs.godotengine.org/en/stable/tutorials/platform/android/android_plugin.html?highlight=notifications#introduction