Detect android back button/swipe
Asked Answered
J

2

0

I am developing a mobile app in godot(it's frustrating, wouldn't reccomend). How can I detect if the user pressed the back button or the back swipe like it's on modern smartphone ?
I found answers on the intenet, but they are all for Godot 3.

Jemma answered 15/7, 2023 at 13:45 Comment(0)
E
0

This is probably what you need:

On Android, NOTIFICATION_WM_GO_BACK_REQUEST is sent instead. Pressing the Back button will exit the application if Application > Config > Quit On Go Back is checked in the Project Settings (which is the default).

https://docs.godotengine.org/en/4.1/tutorials/inputs/handling_quit_requests.html#handling-quit-requests

NOTIFICATION_WM_GO_BACK_REQUEST = 1007

Notification received from the OS when a go back request is sent (e.g. pressing the "Back" button on Android).

Specific to the Android platform.

https://docs.godotengine.org/en/4.1/classes/class_node.html#constants

Epicycle answered 15/7, 2023 at 16:41 Comment(0)
J
0

Is it the escape key ?

Jemma answered 15/7, 2023 at 15:58 Comment(0)
E
0

This is probably what you need:

On Android, NOTIFICATION_WM_GO_BACK_REQUEST is sent instead. Pressing the Back button will exit the application if Application > Config > Quit On Go Back is checked in the Project Settings (which is the default).

https://docs.godotengine.org/en/4.1/tutorials/inputs/handling_quit_requests.html#handling-quit-requests

NOTIFICATION_WM_GO_BACK_REQUEST = 1007

Notification received from the OS when a go back request is sent (e.g. pressing the "Back" button on Android).

Specific to the Android platform.

https://docs.godotengine.org/en/4.1/classes/class_node.html#constants

Epicycle answered 15/7, 2023 at 16:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.