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. QNetworkConfigurationManager onlineStateChanged SIGNAL && Android, iOS ApplicationState Suspended

QNetworkConfigurationManager onlineStateChanged SIGNAL && Android, iOS ApplicationState Suspended

Scheduled Pinned Locked Moved Solved Mobile and Embedded
networkandroidios
5 Posts 2 Posters 2.5k Views
  • 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.
  • E Offline
    E Offline
    ekkescorner
    Qt Champions 2016
    wrote on 16 Mar 2017, 19:10 last edited by
    #1

    in some of my apps I'm using a server queue where all requests are queued while the APP is offline. If network state changes to online the oldest request will be executed and so on.

    With Android and iOS - if I understand it right - if APP changed ApplicationState from Active to Suspended I'm getting a small amount of time to cleanup and then nothing will happen until ApplicationState changes back to Active.

    If Device changes onLine state while the APP is suspended - what will happen with onlineStateChanged SIGNAL ?
    Will I get the SIGNAL when APP becomes Active again ?
    Or do I have to ask QNetworkConfigurationManager isOnline() to get the actual value ?

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

    E 1 Reply Last reply 16 Mar 2017, 20:38
    0
    • E ekkescorner
      16 Mar 2017, 19:10

      in some of my apps I'm using a server queue where all requests are queued while the APP is offline. If network state changes to online the oldest request will be executed and so on.

      With Android and iOS - if I understand it right - if APP changed ApplicationState from Active to Suspended I'm getting a small amount of time to cleanup and then nothing will happen until ApplicationState changes back to Active.

      If Device changes onLine state while the APP is suspended - what will happen with onlineStateChanged SIGNAL ?
      Will I get the SIGNAL when APP becomes Active again ?
      Or do I have to ask QNetworkConfigurationManager isOnline() to get the actual value ?

      E Offline
      E Offline
      ekkescorner
      Qt Champions 2016
      wrote on 16 Mar 2017, 20:38 last edited by
      #2

      @ekkescorner from my tests it seems Qt is really smart :)
      APP is online
      suspend app
      switch to airplane mode and a minute later back
      open APP - as soon as get Active, both SIGNALS (off, on) are delivered correct

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

      E 1 Reply Last reply 16 Mar 2017, 20:50
      1
      • E ekkescorner
        16 Mar 2017, 20:38

        @ekkescorner from my tests it seems Qt is really smart :)
        APP is online
        suspend app
        switch to airplane mode and a minute later back
        open APP - as soon as get Active, both SIGNALS (off, on) are delivered correct

        E Offline
        E Offline
        ekkescorner
        Qt Champions 2016
        wrote on 16 Mar 2017, 20:50 last edited by ekkescorner
        #3

        @ekkescorner so it seems no signal gets lost. (my experiences on Android - have to test from iOS, too)

        but if getting onlineStateChanged() will cause execution of some complex code,
        probably it would be good only to detect the last change and not always swapping between ON and OFF if user was in area with bad network coverage.

        should I disconnect if APP will be suspended and if becomes Active check the state and re-connect to the SIGNAL ?

        What are you doing ?

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

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 16 Mar 2017, 21:24 last edited by
          #4

          Hi,

          Depending on what your application needs to do when coming back online, I'd use a clearable debounce timer to ensure it doesn't start too early if connection quality is bad.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          E 1 Reply Last reply 17 Mar 2017, 06:20
          0
          • S SGaist
            16 Mar 2017, 21:24

            Hi,

            Depending on what your application needs to do when coming back online, I'd use a clearable debounce timer to ensure it doesn't start too early if connection quality is bad.

            E Offline
            E Offline
            ekkescorner
            Qt Champions 2016
            wrote on 17 Mar 2017, 06:20 last edited by
            #5

            @SGaist thx - have thought the same.
            would work well if Active and bad coverage or coming back from suspended when multi signals are received

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

            1 Reply Last reply
            0

            1/5

            16 Mar 2017, 19:10

            • Login

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