Skip to content

Commit adbc917

Browse files
authored
Merge pull request #1389 from kivy/doc_service
Clarify how the package identifier is constructed
2 parents f1a1205 + 4335456 commit adbc917

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

doc/source/services.rst

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,23 @@ code), you must use PyJNIus to interact with the java class
6868
python-for-android creates for each one, as follows::
6969

7070
from jnius import autoclass
71-
service = autoclass('your.package.name.ServiceMyservice')
71+
service = autoclass('your.package.domain.package.name.ServiceMyservice')
7272
mActivity = autoclass('org.kivy.android.PythonActivity').mActivity
7373
argument = ''
7474
service.start(mActivity, argument)
7575

76-
Here, ``your.package.name`` refers to the package identifier of your
77-
APK as set by the ``--package`` argument to python-for-android, and
78-
the name of the service is ``ServiceMyservice``, in which ``Myservice``
79-
is the identifier that was previously passed to the ``--service``
76+
Here, ``your.package.domain.package.name`` refers to the package identifier
77+
of your APK.
78+
79+
If you are using buildozer, the identifier is set by the ``package.name``
80+
and ``package.domain`` values in your buildozer.spec file.
81+
The name of the service is ``ServiceMyservice``, where ``Myservice``
82+
is the name specied by one of the ``services`` values, but with the first
83+
letter upper case.
84+
85+
If you are using python-for-android directly, the identifier is set by the ``--package``
86+
argument to python-for-android. The name of the service is ``ServiceMyservice``,
87+
where ``Myservice`` is the identifier that was previously passed to the ``--service``
8088
argument, but with the first letter upper case. You must also pass the
8189
``argument`` parameter even if (as here) it is an empty string. If you
8290
do pass it, the service can make use of this argument.

0 commit comments

Comments
 (0)