Results 1 to 2 of 2

Thread: Cannot keep screen alive in Android

  1. #1
    Join Date
    Apr 2011
    Posts
    31
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Cannot keep screen alive in Android

    In $$PWD/android/res/layout/ I have:

    Qt Code:
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    3. android:layout_width="match_parent"
    4. android:layout_height="match_parent"
    5. android:keepScreenOn="true"
    6. android:id="@+id/main"
    7. />
    To copy to clipboard, switch view to plain text mode 

    and
    Qt Code:
    1. <uses-permission android:name="android.permission.WAKE_LOCK"/>
    To copy to clipboard, switch view to plain text mode 
    in AndroidManifest.xml.

    I even tried add

    Qt Code:
    1. QtNative.activity().getWindow().setFlags( WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
    2. WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON );
    To copy to clipboard, switch view to plain text mode 

    tо onCreate() method of class extending org.qtproject.qt5.android.bindings.QtActivity. Nothing helps.
    Device goes sleep and locked in all cases. What can be wrong? What should I do to disable screen of and lock?
    I test program in Android 6.0.
    Last edited by Gourmet; 5th April 2017 at 19:37.

  2. #2
    Join Date
    Apr 2011
    Posts
    31
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Cannot keep screen alive in Android

    I solved this only by locking PowerManager.WakeLock object like here. All other ways do not work.

Similar Threads

  1. QNetworkAccessManager keep-alive ?
    By tsuibin in forum Qt Programming
    Replies: 2
    Last Post: 6th May 2016, 12:05
  2. White Screen while starting a qt application on a especific Android device
    By felipe.c.sousa in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 25th November 2015, 18:10
  3. Replies: 3
    Last Post: 25th July 2013, 05:11
  4. [Android] volatile size of screen
    By franki in forum Qt Programming
    Replies: 3
    Last Post: 10th January 2013, 09:54
  5. QTcpSocket and keep-alive option.
    By fanat9 in forum Qt Programming
    Replies: 2
    Last Post: 20th February 2008, 17:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.