Android / iOS - Signals if suspended / killed


  • Qt Champions 2016

    FWIW: Read some Threads about this and then did some tests:
    Qt 5.7 - Android 6.0.1, iOS 9.3

    Here's my summary about SIGNALS sent if APP will be paused:

    ANDROID:
    Leaving the APP using Android BACK Button:
    QGuiApplication::aboutToQuit
    NO ApplicationState Changed SIGNAL

    Using Android Buttons HOME or OVERVIEW to minimize the APP:
    Qt::ApplicationState(ApplicationInactive) followed by
    Qt::ApplicationState(ApplicationSuspended)

    iOS:
    HOME Button to send APP to back:
    Qt::ApplicationState(ApplicationInactive) followed by
    Qt::ApplicationState(ApplicationSuspended)

    DoubleClick on HOME:
    Qt::ApplicationState(ApplicationInactive) while visible, then if clicking anywhere else:
    Qt::ApplicationState(ApplicationSuspended)

    CLOSE Suspended APP:
    NO ApplicationState Changed SIGNAL

    Solution
    Apps can be closed without a SIGNAL, to be safe loosing no data, you should watch:
    Qt::ApplicationState(ApplicationSuspended)
    AND
    QGuiApplication::aboutToQuit

    to do your cleanup code


  • Qt Champions 2016

    have to add another situation:

    iOS
    DoubleClick on HOME:
    Qt::ApplicationState(ApplicationInactive)
    then close the app (swipe minimized app out of visible area):
    Qt::ApplicationState(ApplicationSuspended)
    immediately followed by
    QGuiApplication::aboutToQuit


    So it's not a good idea to cleanup / save data from ApplicationSuspended and aboutToQuit, because on iOS both happened and you would do the job twice.

    you should watch the state and check if cleanup is running or already was done
    (will provide a sample app soon)


Log in to reply
 

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