Is it possible to make a Qt Android app with a UI into a foreground service?
-
What I want do do is to have an app that can keep a network connection open also when it's not in the foreground, and have internal timers running so it can play notification sounds at certain times. When incoming messages come over the network, it updates a local sqlite database and may re-arrange when sounds are to be played.
What's happening now is that as soon as the app is not in the foreground, Android puts it to sleep.
According to ChatGpt Android foreground services are not supported in Qt 6.8.3 or newer.
-
What I want do do is to have an app that can keep a network connection open also when it's not in the foreground, and have internal timers running so it can play notification sounds at certain times. When incoming messages come over the network, it updates a local sqlite database and may re-arrange when sounds are to be played.
What's happening now is that as soon as the app is not in the foreground, Android puts it to sleep.
According to ChatGpt Android foreground services are not supported in Qt 6.8.3 or newer.
@jarle On Android you need a background service to do this. See https://doc.qt.io/qt-6/android-services.html
-
@jarle On Android you need a background service to do this. See https://doc.qt.io/qt-6/android-services.html
-
@jsulm I know I can make a background service. But as far as I know, that runs in a separate process. I am looking for the foreground service functionality, where one process can handle both the UI and the service requirements.
@jarle Take a look at foreground services: https://developer.android.com/develop/background-work/services?hl=en