8
8
9
9
Most platforms have the option to request the application to quit. On
10
10
desktops, this is usually done with the "x" icon on the window title bar.
11
- On Android , the back button is used to quit when on the main screen (and
12
- to go back otherwise) .
11
+ On mobile devices , the app can quit at any time while it is suspended
12
+ to the background .
13
13
14
14
Handling the notification
15
15
-------------------------
@@ -18,16 +18,6 @@ On desktop and web platforms, :ref:`Node <class_Node>` receives a special
18
18
``NOTIFICATION_WM_CLOSE_REQUEST `` notification when quitting is requested from
19
19
the window manager.
20
20
21
- On Android, ``NOTIFICATION_WM_GO_BACK_REQUEST `` is sent instead.
22
- Pressing the Back button will exit the application if
23
- **Application > Config > Quit On Go Back ** is checked in the Project Settings
24
- (which is the default).
25
-
26
- .. note ::
27
-
28
- ``NOTIFICATION_WM_GO_BACK_REQUEST `` isn't supported on iOS, as
29
- iOS devices don't have a physical Back button.
30
-
31
21
Handling the notification is done as follows (on any node):
32
22
33
23
.. tabs ::
@@ -45,9 +35,6 @@ Handling the notification is done as follows (on any node):
45
35
GetTree().Quit(); // default behavior
46
36
}
47
37
48
- When developing mobile apps, quitting is not desired unless the user is
49
- on the main screen, so the behavior can be changed.
50
-
51
38
It is important to note that by default, Godot apps have the built-in
52
39
behavior to quit when quit is requested from the window manager. This
53
40
can be changed, so that the user can take care of the complete quitting
@@ -62,6 +49,22 @@ procedure:
62
49
63
50
GetTree().AutoAcceptQuit = false;
64
51
52
+ On mobile devices
53
+ -----------------
54
+
55
+ There is no direct equivalent to ``NOTIFICATION_WM_CLOSE_REQUEST `` on mobile
56
+ platforms. Due to the nature of mobile operating systems, the only place
57
+ that you can run code prior to quitting is when the app is being suspended to
58
+ the background. On both Android and iOS, the app can be killed while suspended
59
+ at any time by either the user or the OS. A way to plan ahead for this
60
+ possibility is to utilize ``NOTIFICATION_APPLICATION_PAUSED `` in order to
61
+ perform any needed actions as the app is being suspended.
62
+
63
+ On Android, pressing the Back button will exit the application if
64
+ **Application > Config > Quit ** On Go Back is checked in the Project Settings
65
+ (which is the default). This will fire ``NOTIFICATION_WM_GO_BACK_REQUEST ``.
66
+
67
+
65
68
Sending your own quit notification
66
69
----------------------------------
67
70
0 commit comments