Android Services
Starting with Qt 5.7 you can use Qt to create Android services. A service is a component that runs in background, so, it has no user interface. It is useful to perform long-time operations (for example log GPS, wait 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, you need to do the following steps:
- Uncomment the service part of your AndroidManifest.xml
- Make sure the
servicetag contains anandroid:process=":some_name"attribute. It is needed to force theserviceto 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.argumentsmeta-datato pass some arguments to yourmainfunction in order to know which one is which. - Enable background running. Uncomment
android.app.background_runningmeta-dataand set it to true (android:value="true").
Qt will load the .so file defined in android.app.lib_name meta-data, will call the main function with all the arguments set in android.app.arguments meta-data.
See Android Services documentation for more info on this matter.