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] Keep application running when device go to sleep
Forum Update on Monday, May 27th 2025

[Android] Keep application running when device go to sleep

Scheduled Pinned Locked Moved Mobile and Embedded
5 Posts 3 Posters 7.0k 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.
  • K Offline
    K Offline
    kolegs
    wrote on last edited by
    #1

    Hi,

    is there a way to keep application running while device go to sleep?

    Thanks in advance

    1 Reply Last reply
    0
    • D Offline
      D Offline
      derhexer
      wrote on last edited by
      #2

      I don't think so. If a device goes into sleep mode, only some kernel parts will not sleep. If any other app will be able to run in sleep mode, what meaning will a sleep mode have?

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kolegs
        wrote on last edited by
        #3

        So another question, is there a way to prevent device from going into sleep mode, while application is running?

        1 Reply Last reply
        0
        • D Offline
          D Offline
          derhexer
          wrote on last edited by
          #4

          Yes. But i don't know the Qt possibilities in this case.

          http://developer.android.com/reference/android/os/PowerManager.html

          Take a look at WakeLock...

          1 Reply Last reply
          0
          • T Offline
            T Offline
            terenty
            wrote on last edited by
            #5

            HI, actually you can force device screen to stay active while your app is running. You need to modify QtActivity like it's done "here.":http://sourceforge.net/p/erebusrpg/code/ci/master/tree/android/src/org/kde/necessitas/origo/QtActivity.java#l592 (direct link to your problem solution)
            This link is to some opensource Qt based game that runs also on android. It's called Erebus RPG. You can find some really usefull stuf there like integrating c++ with java in order to handle Activity states etc. Look at "main.cpp":http://sourceforge.net/p/erebusrpg/code/ci/master/tree/

            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