We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Android: `paths.app` doesn't work in event handlers
**Describe the bug**

On Android, `paths.app` returns `/` when called outside of the `startup` method, e.g. in an event handler. This is because the `__main__` module has finished importing, and it no longer exists in `sys.modules` under that name.

This doesn't happen on Windows, because it runs the entire main loop within the top level of the `__main__` module. The other desktop platforms are probably the same.

But on Android, the main loop is already running and we have to integrate into it, so importing the `__main__` module does not block. From inspection of the code, it looks like iOS is similar, so it might have the same problem.

The fallback to `/` makes no sense on Android anyway, so it should be removed.

Reported by @kakos-k9 on Discord.

**Test app**
```python
import toga
from toga.style import Pack
from toga.style.pack import COLUMN, ROW

class Hello(toga.App):

    def startup(self):
        button = toga.Button("Print", on_press=self.on_press)
        self.on_press(button)

        self.main_window = toga.MainWindow()
        self.main_window.content = toga.Box(
            style=Pack(direction=COLUMN),
            children=[button]
        )
        self.main_window.show()

    def on_press(self, button):
        import traceback
        for name in ["app", "data", "toga"]:
            print(f"{name}={getattr(self.paths, name)}")


def main():
    return Hello()
```

**Environment:**
 - Operating System: Android
 - Python version: 3.8
 - Software versions:
   - Toga: 9a292f8e26


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/android/toga_android/paths.py`
Content:
```
1 import sys
2 from pathlib import Path
3 
4 import toga
5 from toga import App
6 
7 
8 class Paths:
9     # Allow instantiating Path object via the factory
10     Path = Path
11 
12     @property
13     def __context(self):
14         return App.app._impl.native.getApplicationContext()
15 
16     @property
17     def app(self):
18         try:
19             return Path(sys.modules["__main__"].__file__).parent
20         except KeyError:
21             # If we're running in test conditions,
22             # there is no __main__ module.
23             return Path.cwd()
24         except AttributeError:
25             # If we're running at an interactive prompt,
26             # the __main__ module isn't file-based.
27             return Path.cwd()
28 
29     @property
30     def data(self):
31         return Path(self.__context.getFilesDir().getPath())
32 
33     @property
34     def cache(self):
35         return Path(self.__context.getCacheDir().getPath())
36 
37     @property
38     def logs(self):
39         return self.data
40 
41     @property
42     def toga(self):
43         """Return a path to a Toga resources
44         """
45         return Path(toga.__file__).parent
46 
47 
48 paths = Paths()
49
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/android/toga_android/paths.py b/src/android/toga_android/paths.py
--- a/src/android/toga_android/paths.py
+++ b/src/android/toga_android/paths.py
@@ -13,18 +13,13 @@
     def __context(self):
         return App.app._impl.native.getApplicationContext()
 
+    def __init__(self):
+        # On Android, __main__ only exists during app startup, so cache its location now.
+        self._app = Path(sys.modules["__main__"].__file__).parent
+
     @property
     def app(self):
-        try:
-            return Path(sys.modules["__main__"].__file__).parent
-        except KeyError:
-            # If we're running in test conditions,
-            # there is no __main__ module.
-            return Path.cwd()
-        except AttributeError:
-            # If we're running at an interactive prompt,
-            # the __main__ module isn't file-based.
-            return Path.cwd()
+        return self._app
 
     @property
     def data(self):

{"golden_diff": "diff --git a/src/android/toga_android/paths.py b/src/android/toga_android/paths.py\n--- a/src/android/toga_android/paths.py\n+++ b/src/android/toga_android/paths.py\n@@ -13,18 +13,13 @@\n     def __context(self):\n         return App.app._impl.native.getApplicationContext()\n \n+    def __init__(self):\n+        # On Android, __main__ only exists during app startup, so cache its location now.\n+        self._app = Path(sys.modules[\"__main__\"].__file__).parent\n+\n     @property\n     def app(self):\n-        try:\n-            return Path(sys.modules[\"__main__\"].__file__).parent\n-        except KeyError:\n-            # If we're running in test conditions,\n-            # there is no __main__ module.\n-            return Path.cwd()\n-        except AttributeError:\n-            # If we're running at an interactive prompt,\n-            # the __main__ module isn't file-based.\n-            return Path.cwd()\n+        return self._app\n \n     @property\n     def data(self):\n", "issue": "Android: `paths.app` doesn't work in event handlers\n**Describe the bug**\r\n\r\nOn Android, `paths.app` returns `/` when called outside of the `startup` method, e.g. in an event handler. This is because the `__main__` module has finished importing, and it no longer exists in `sys.modules` under that name.\r\n\r\nThis doesn't happen on Windows, because it runs the entire main loop within the top level of the `__main__` module. The other desktop platforms are probably the same.\r\n\r\nBut on Android, the main loop is already running and we have to integrate into it, so importing the `__main__` module does not block. From inspection of the code, it looks like iOS is similar, so it might have the same problem.\r\n\r\nThe fallback to `/` makes no sense on Android anyway, so it should be removed.\r\n\r\nReported by @kakos-k9 on Discord.\r\n\r\n**Test app**\r\n```python\r\nimport toga\r\nfrom toga.style import Pack\r\nfrom toga.style.pack import COLUMN, ROW\r\n\r\nclass Hello(toga.App):\r\n\r\n    def startup(self):\r\n        button = toga.Button(\"Print\", on_press=self.on_press)\r\n        self.on_press(button)\r\n\r\n        self.main_window = toga.MainWindow()\r\n        self.main_window.content = toga.Box(\r\n            style=Pack(direction=COLUMN),\r\n            children=[button]\r\n        )\r\n        self.main_window.show()\r\n\r\n    def on_press(self, button):\r\n        import traceback\r\n        for name in [\"app\", \"data\", \"toga\"]:\r\n            print(f\"{name}={getattr(self.paths, name)}\")\r\n\r\n\r\ndef main():\r\n    return Hello()\r\n```\r\n\r\n**Environment:**\r\n - Operating System: Android\r\n - Python version: 3.8\r\n - Software versions:\r\n   - Toga: 9a292f8e26\r\n\n", "before_files": [{"content": "import sys\nfrom pathlib import Path\n\nimport toga\nfrom toga import App\n\n\nclass Paths:\n    # Allow instantiating Path object via the factory\n    Path = Path\n\n    @property\n    def __context(self):\n        return App.app._impl.native.getApplicationContext()\n\n    @property\n    def app(self):\n        try:\n            return Path(sys.modules[\"__main__\"].__file__).parent\n        except KeyError:\n            # If we're running in test conditions,\n            # there is no __main__ module.\n            return Path.cwd()\n        except AttributeError:\n            # If we're running at an interactive prompt,\n            # the __main__ module isn't file-based.\n            return Path.cwd()\n\n    @property\n    def data(self):\n        return Path(self.__context.getFilesDir().getPath())\n\n    @property\n    def cache(self):\n        return Path(self.__context.getCacheDir().getPath())\n\n    @property\n    def logs(self):\n        return self.data\n\n    @property\n    def toga(self):\n        \"\"\"Return a path to a Toga resources\n        \"\"\"\n        return Path(toga.__file__).parent\n\n\npaths = Paths()\n", "path": "src/android/toga_android/paths.py"}], "after_files": [{"content": "import sys\nfrom pathlib import Path\n\nimport toga\nfrom toga import App\n\n\nclass Paths:\n    # Allow instantiating Path object via the factory\n    Path = Path\n\n    @property\n    def __context(self):\n        return App.app._impl.native.getApplicationContext()\n\n    def __init__(self):\n        # On Android, __main__ only exists during app startup, so cache its location now.\n        self._app = Path(sys.modules[\"__main__\"].__file__).parent\n\n    @property\n    def app(self):\n        return self._app\n\n    @property\n    def data(self):\n        return Path(self.__context.getFilesDir().getPath())\n\n    @property\n    def cache(self):\n        return Path(self.__context.getCacheDir().getPath())\n\n    @property\n    def logs(self):\n        return self.data\n\n    @property\n    def toga(self):\n        \"\"\"Return a path to a Toga resources\n        \"\"\"\n        return Path(toga.__file__).parent\n\n\npaths = Paths()\n", "path": "src/android/toga_android/paths.py"}]}