Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Android / iOS - Signals if suspended / killed

Android / iOS - Signals if suspended / killed

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 1 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ekkescornerE Offline
    ekkescornerE Offline
    ekkescorner
    Qt Champions 2016
    wrote on last edited by
    #1

    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

    ekke ... Qt Champion 2016 | 2024 ... mobile business apps
    5.15 --> 6.9 https://t1p.de/ekkeChecklist
    QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

    1 Reply Last reply
    3
    • ekkescornerE Offline
      ekkescornerE Offline
      ekkescorner
      Qt Champions 2016
      wrote on last edited by
      #2

      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)

      ekke ... Qt Champion 2016 | 2024 ... mobile business apps
      5.15 --> 6.9 https://t1p.de/ekkeChecklist
      QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved