@@ -8,9 +8,14 @@ possible to use normal multiprocessing on Android. Services are also
8
8
the only way to run code when your app is not currently opened by the user.
9
9
10
10
Services must be declared when building your APK. Each one
11
- will have its own main.py file with the Python script to be run. You
12
- can communicate with the service process from your app using e.g. `osc
13
- <https://pypi.python.org/pypi/python-osc> `__ or (a heavier option)
11
+ will have its own main.py file with the Python script to be run.
12
+ Please note that python-for-android explicitly runs services as separated
13
+ processes by having a colon ":" in the beginning of the name assigned to
14
+ the ``android:process `` attribute of the ``AndroidManifest.xml `` file.
15
+ This is not the default behavior, see `Android service documentation
16
+ <https://developer.android.com/guide/topics/manifest/service-element> `__.
17
+ You can communicate with the service process from your app using e.g.
18
+ `osc <https://pypi.python.org/pypi/python-osc >`__ or (a heavier option)
14
19
`twisted <https://twistedmatrix.com/trac/ >`__.
15
20
16
21
Service creation
@@ -87,3 +92,14 @@ documented here but all accessible via calling other methods of the
87
92
your service folder you must use e.g. ``import service.module ``
88
93
instead of ``import module ``, if the service file is in the
89
94
``service/ `` folder.
95
+
96
+ Service auto-restart
97
+ ~~~~~~~~~~~~~~~~~~~~
98
+
99
+ It is possible to make services restart automatically when they exit by
100
+ calling ``setAutoRestartService(True) `` on the service object.
101
+ The call to this method should be done within the service code::
102
+
103
+ from jnius import autoclass
104
+ PythonService = autoclass('org.kivy.android.PythonService')
105
+ PythonService.mService.setAutoRestartService(True)
0 commit comments