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. Application In the background stop

Application In the background stop

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
6 Posts 2 Posters 1.1k 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.
  • NickVN Offline
    NickVN Offline
    NickV
    wrote on last edited by
    #1

    Hi,
    my application stop after a long time when i press home button and lock the phone. Does anyone knows why is this happens?
    Also any suggestions about how i can stop this annoying behaviour?

    Thanks in advance!

    raven-worxR 1 Reply Last reply
    0
    • NickVN NickV

      Hi,
      my application stop after a long time when i press home button and lock the phone. Does anyone knows why is this happens?
      Also any suggestions about how i can stop this annoying behaviour?

      Thanks in advance!

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @NickV said in Application In the background stop:

      Also any suggestions about how i can stop this annoying behaviour?

      If you talk about Android there is no way, since this is intended to behavior. The Android system manages the lifecycle of the app.
      If you depend on background functionality you should take a look at Android services.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      3
      • NickVN Offline
        NickVN Offline
        NickV
        wrote on last edited by
        #3

        Have you ever worked with postgres triggers and services?
        In order to make triggers work you should always be connected with the database and subscribed to the notifications.

        raven-worxR 1 Reply Last reply
        0
        • NickVN NickV

          Have you ever worked with postgres triggers and services?
          In order to make triggers work you should always be connected with the database and subscribed to the notifications.

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          @NickV
          as i said. If you have this requirement you need to use Android services (rather than App). The App then communicates with the Android Service.

          If you are working on Android afterall, since you didn't answer that question yet.

          But anyway, if it is all about a DB connection. Why do you need to be connected even if your app is in the background? Why don't you simple resetup the connection everytime the app comes back to the foreground, than drowning the device's battery with functionality which isn't necessary while the app is in the background?!

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          1
          • NickVN Offline
            NickVN Offline
            NickV
            wrote on last edited by
            #5

            Yes i work with Android.
            I need to be all the time connected because i use notification manager in order to notify the user about incoming data. The problem is that if i use services i need to make the service reconnect to the database if i loose internet connection and subscribe again to the notifications. I don't even know if this is possible with the postgres driver because i've tested postegres to be opened in another thread for example and triggers not work. So i don't know if postgres works with services.

            raven-worxR 1 Reply Last reply
            0
            • NickVN NickV

              Yes i work with Android.
              I need to be all the time connected because i use notification manager in order to notify the user about incoming data. The problem is that if i use services i need to make the service reconnect to the database if i loose internet connection and subscribe again to the notifications. I don't even know if this is possible with the postgres driver because i've tested postegres to be opened in another thread for example and triggers not work. So i don't know if postgres works with services.

              raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by raven-worx
              #6

              @NickV said in Application In the background stop:

              So i don't know if postgres works with services.

              There is not much difference between an App and a Service. A service runs permanently in the background and has no UI.
              From Qt point of view the difference is even less. So i don't see why it shouldn't work.

              1. create a Android service
              2. in the service setup your DB connection
              3. create an Android app
              4. use IPC to communicate with the service (e.g. you can use QtRemoteObjects for that)
              5. when the service triggers a notification message let the app display it

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              1 Reply Last reply
              3

              • Login

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