Android Services
Starting with Qt 5.7, you can create Android services using Qt. A service is a component that runs in background, so, it has no user interface. It is useful to perform long-term operations such as logging GPS, waiting for social media notifications, and so on. A service will continue to run even if the application that started it exits.
To create a service, do the following steps:
- Uncomment the service part of your
AndroidManifest.xml
. - Make sure the
service
tag contains anandroid:process=":some_name"
attribute. It is needed to force theservice
to run in a separate process than theactivity
. - If you're using the same application (.so file) for activity and also for service, you need to use
android.app.arguments
meta-data
to pass some arguments to yourmain
function in order to know which one is which. - To enable background running, uncomment
android.app.background_running
meta-data
and set it to true (android:value="true"
).
Qt loads the .so
file defined in android.app.lib_name
meta-data
, and calls the main
function with all the arguments set in android.app.arguments
meta-data
.
See Android Services documentation for more information.
© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-5.14/android-services.html