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
- Make sure the
servicetag contains an
android:process=":some_name"attribute. It is needed to force the
serviceto run in a separate process than the
- If you're using the same application (.so file) for activity and also for service, you need to use
meta-datato pass some arguments to your
mainfunction in order to know which one is which.
- To enable background running, uncomment
meta-dataand set it to true (
Qt loads the
.so file defined in
meta-data, and calls the
main function with all the arguments set in
See Android Services documentation for more information.
© 2020 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.