Important: Please read the Qt Code of Conduct -

[SOLVED] Detect when app is sent to backround on Android

  • I want to log out the user when the app is sent to the background (working on android).
    Can I somehow detect this on android?

  • Hi,

    you can simply listen on the Qt.application State property. Here's some qml sample code you can put into main.qml:

    Connections {
        target: Qt.application
        onStateChanged: {
            console.debug("applicationStateChanged: " + Qt.application.state)
                if (Qt.application.state === Qt.ApplicationActive) {
                    //we're back from idle
                else {
                    //going to background

Log in to reply