88
99Most platforms have the option to request the application to quit. On
1010desktops, 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 .
1313
1414Handling the notification
1515-------------------------
@@ -18,16 +18,6 @@ On desktop and web platforms, :ref:`Node <class_Node>` receives a special
1818``NOTIFICATION_WM_CLOSE_REQUEST `` notification when quitting is requested from
1919the window manager.
2020
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-
3121Handling the notification is done as follows (on any node):
3222
3323.. tabs ::
@@ -45,9 +35,6 @@ Handling the notification is done as follows (on any node):
4535 GetTree().Quit(); // default behavior
4636 }
4737
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-
5138It is important to note that by default, Godot apps have the built-in
5239behavior to quit when quit is requested from the window manager. This
5340can be changed, so that the user can take care of the complete quitting
@@ -62,6 +49,22 @@ procedure:
6249
6350 GetTree().AutoAcceptQuit = false;
6451
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+
6568Sending your own quit notification
6669----------------------------------
6770
0 commit comments