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. Is it possible to make a Qt Android app with a UI into a foreground service?
Forum Updated to NodeBB v4.3 + New Features

Is it possible to make a Qt Android app with a UI into a foreground service?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
4 Posts 2 Posters 43 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.
  • J Offline
    J Offline
    jarle
    wrote last edited by
    #1

    What I want do do is to have an app that can keep a network connection open also when it's not in the foreground, and have internal timers running so it can play notification sounds at certain times. When incoming messages come over the network, it updates a local sqlite database and may re-arrange when sounds are to be played.

    What's happening now is that as soon as the app is not in the foreground, Android puts it to sleep.

    According to ChatGpt Android foreground services are not supported in Qt 6.8.3 or newer.

    jsulmJ 1 Reply Last reply
    0
    • J jarle

      What I want do do is to have an app that can keep a network connection open also when it's not in the foreground, and have internal timers running so it can play notification sounds at certain times. When incoming messages come over the network, it updates a local sqlite database and may re-arrange when sounds are to be played.

      What's happening now is that as soon as the app is not in the foreground, Android puts it to sleep.

      According to ChatGpt Android foreground services are not supported in Qt 6.8.3 or newer.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote last edited by
      #2

      @jarle On Android you need a background service to do this. See https://doc.qt.io/qt-6/android-services.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      J 1 Reply Last reply
      0
      • jsulmJ jsulm

        @jarle On Android you need a background service to do this. See https://doc.qt.io/qt-6/android-services.html

        J Offline
        J Offline
        jarle
        wrote last edited by
        #3

        @jsulm I know I can make a background service. But as far as I know, that runs in a separate process. I am looking for the foreground service functionality, where one process can handle both the UI and the service requirements.

        jsulmJ 1 Reply Last reply
        0
        • J jarle

          @jsulm I know I can make a background service. But as far as I know, that runs in a separate process. I am looking for the foreground service functionality, where one process can handle both the UI and the service requirements.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote last edited by
          #4

          @jarle Take a look at foreground services: https://developer.android.com/develop/background-work/services?hl=en

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          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