Running Qt 5.4 on Android in the background



  • I'm seeing a problem that when my Qt 5.4 app is running in the background on Android, it's not able to execute any Javascript code. Furthermore, the Timer object stops running and it seems like the Qt main thread is put on pause. I have a scenario where I have a background thread that sends a signal when a certain event is received, and upon receiving this signal in QML, I need to do some work in JS. In Qt 5.4, when your app is in the background, the signal is sent but your QML code never receives it until it goes on the foreground.

    I know in the AndroidManifest.xml, there's this line:
    <meta-data android:name="android.app.background_running" android:value="false"/>

    When I try to set it to true, my app crashes.

    It runs fine in Qt 5.3. Is Qt going to fix this issue for Qt 5.4? Is there a workaround that I can do for this issue?

    Thanks.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Sounds like a regression
    The best thing to do is check the bug report system to see if it something known. If not please consider opening a new report providing a minimal compilable example showing the behavior.



  • I have also noticed the same issue when my Qt 5.4 application is run on Android in the background:

    • A QML Timer object will pause until the application is put back to the foreground.
    • On the other hand, a QTimer object (created in C++, and not exposed to QML) still works correctly in the background.
      This appears to be a regression from Qt 5.3 to Qt 5.4. Hope this regression can be fixed in Qt 5.5.

  • Lifetime Qt Champion

    Did you verify if there something about it in the bug tracker ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.