瀏覽代碼

Merge pull request #8980 from ztc0611/fix-mobile-save-docs

Fix Handling Quit Requests wording about mobile platforms
Max Hilbrunner 1 年之前
父節點
當前提交
747d07ad51
共有 1 個文件被更改,包括 18 次插入15 次删除
  1. 18 15
      tutorials/inputs/handling_quit_requests.rst

+ 18 - 15
tutorials/inputs/handling_quit_requests.rst

@@ -8,8 +8,8 @@ Quitting
 
 
 Most platforms have the option to request the application to quit. On
 Most platforms have the option to request the application to quit. On
 desktops, this is usually done with the "x" icon on the window title bar.
 desktops, this is usually done with the "x" icon on the window title bar.
-On Android, the back button is used to quit when on the main screen (and
-to go back otherwise).
+On mobile devices, the app can quit at any time while it is suspended
+to the background.
 
 
 Handling the notification
 Handling the notification
 -------------------------
 -------------------------
@@ -18,16 +18,6 @@ On desktop and web platforms, :ref:`Node <class_Node>` receives a special
 ``NOTIFICATION_WM_CLOSE_REQUEST`` notification when quitting is requested from
 ``NOTIFICATION_WM_CLOSE_REQUEST`` notification when quitting is requested from
 the window manager.
 the window manager.
 
 
-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).
-
-.. note::
-
-    ``NOTIFICATION_WM_GO_BACK_REQUEST`` isn't supported on iOS, as
-    iOS devices don't have a physical Back button.
-
 Handling the notification is done as follows (on any node):
 Handling the notification is done as follows (on any node):
 
 
 .. tabs::
 .. tabs::
@@ -45,9 +35,6 @@ Handling the notification is done as follows (on any node):
             GetTree().Quit(); // default behavior
             GetTree().Quit(); // default behavior
     }
     }
 
 
-When developing mobile apps, quitting is not desired unless the user is
-on the main screen, so the behavior can be changed.
-
 It is important to note that by default, Godot apps have the built-in
 It is important to note that by default, Godot apps have the built-in
 behavior to quit when quit is requested from the window manager. This
 behavior to quit when quit is requested from the window manager. This
 can be changed, so that the user can take care of the complete quitting
 can be changed, so that the user can take care of the complete quitting
@@ -62,6 +49,22 @@ procedure:
 
 
     GetTree().AutoAcceptQuit = false;
     GetTree().AutoAcceptQuit = false;
 
 
+On mobile devices
+-----------------
+
+There is no direct equivalent to ``NOTIFICATION_WM_CLOSE_REQUEST`` on mobile 
+platforms. Due to the nature of mobile operating systems, the only place 
+that you can run code prior to quitting is when the app is being suspended to 
+the background. On both Android and iOS, the app can be killed while suspended 
+at any time by either the user or the OS. A way to plan ahead for this 
+possibility is to utilize ``NOTIFICATION_APPLICATION_PAUSED`` in order to 
+perform any needed actions as the app is being suspended.
+
+On Android, 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). This will fire ``NOTIFICATION_WM_GO_BACK_REQUEST``.
+
+
 Sending your own quit notification
 Sending your own quit notification
 ----------------------------------
 ----------------------------------