Qt World Summit: Register Today!

How to enable signals while Android app is in background

  • Hello,

    I am trying to integrate VoIP Push Notifications in my app, so I can handle incoming connections. However, while the app is not in the foreground I cannot process any signals with Qt. It seems as if all signals emitted through queued connections are dropped (direct connections work, but are useless because Firebase runs in a different thread). Is there any way to temporarily activate regular signal processing while in background?

    Thanks a lot.

  • Lifetime Qt Champion

    @Andreas-E. I think you will need to implement a background service. Not active applications are stopped, so event loop is stopped.

  • Thank you, using a service came to my mind, but would be quite difficult to integrate. Currently I am using

    <meta-data android:name="android.app.background_running" android:value="true"/>

    in the Android manifest which keeps the event loop running in background.

  • Moderators

    hi @Andreas-E.
    you should investigate that further, because from my experience, all apps without background service eventually get suspended from non rooted devices.

    That includes apps with the manifest change

    <meta-data android:name="android.app.background_running" android:value="true"/>

    with this change, it will just take longer until the app becomes suspended

  • Hi @J-Hilk
    I only need background operation for a short time after receiving an FCM data notification. I would expect the app to be woken up by the system in this case? But I'm still not sure if this will also wake up the event loop.

Log in to reply