<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[SOLVED]How to keep the backlight on(Android)?]]></title><description><![CDATA[<p dir="auto">I develop android app with Qt 5.1.0 RC1.<br />
I want to keep the backlight on.</p>
<p dir="auto">@#include &lt;android/native_activity.h&gt;</p>
<p dir="auto">ANativeActivity *theActivity;<br />
ANativeActivity_setWindowFlags(theActivity,AWINDOW_FLAG_KEEP_SCREEN_ON,0);@</p>
<p dir="auto">but compile error:<br />
undefined reference to 'ANativeActivity_setWindowFlags'</p>
<p dir="auto">Someone can help me?<br />
thanks a lot.</p>
]]></description><link>https://forum.qt.io/topic/28534/solved-how-to-keep-the-backlight-on-android</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 21:17:33 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/28534.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 21 Jun 2013 00:35:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [SOLVED]How to keep the backlight on(Android)? on Mon, 21 Apr 2014 17:20:35 GMT]]></title><description><![CDATA[<p dir="auto">Thank you, Peterlin, that achieved the same result for me.</p>
<p dir="auto">Note: If someone uses Qt 5.2, modifies the QtActivity.java file and then that file is automatically overwritten, in my case it was very useful "that article":<a href="http://blog.qt.digia.com/blog/2013/12/12/implementing-in-app-purchase-on-android" target="_blank" rel="noopener noreferrer nofollow ugc">http://blog.qt.digia.com/blog/2013/12/12/implementing-in-app-purchase-on-android</a> (people can search there the text <em>"Next, I added a new Activity subclass"</em>) and "that example":<a href="http://qt-project.org/doc/qt-5/qtandroidextras-notification-example.html" target="_blank" rel="noopener noreferrer nofollow ugc">http://qt-project.org/doc/qt-5/qtandroidextras-notification-example.html</a>.</p>
]]></description><link>https://forum.qt.io/post/201319</link><guid isPermaLink="true">https://forum.qt.io/post/201319</guid><dc:creator><![CDATA[Ganton]]></dc:creator><pubDate>Mon, 21 Apr 2014 17:20:35 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED]How to keep the backlight on(Android)? on Fri, 18 Apr 2014 05:23:34 GMT]]></title><description><![CDATA[<p dir="auto">I don't know how to obtain the pointer to the native activity running your Qt app.<br />
and that seems to be not necessary.</p>
<p dir="auto">I solved by add<br />
getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);<br />
on QtActivity.java</p>
]]></description><link>https://forum.qt.io/post/201315</link><guid isPermaLink="true">https://forum.qt.io/post/201315</guid><dc:creator><![CDATA[peterlin82]]></dc:creator><pubDate>Fri, 18 Apr 2014 05:23:34 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED]How to keep the backlight on(Android)? on Tue, 01 Apr 2014 16:10:54 GMT]]></title><description><![CDATA[<p dir="auto">By the way, about the code:<br />
@ANativeActivity *theActivity;<br />
ANativeActivity_setWindowFlags(theActivity,AWINDOW_FLAG_KEEP_SCREEN_ON,0);<br />
@<br />
I've been searching for this for several days :-( : Please, how can you obtain the pointer to the native activity running your Qt app?</p>
]]></description><link>https://forum.qt.io/post/201265</link><guid isPermaLink="true">https://forum.qt.io/post/201265</guid><dc:creator><![CDATA[Ganton]]></dc:creator><pubDate>Tue, 01 Apr 2014 16:10:54 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED]How to keep the backlight on(Android)? on Thu, 27 Mar 2014 19:32:23 GMT]]></title><description><![CDATA[<p dir="auto">Thank you, Moster!</p>
<p dir="auto">If it can be useful to anyone, in my case (Qt 5.2.1, QtCreator 3.0.1, Android NDK, Revision 9c):</p>
<ol>
<li>
<p dir="auto">I added the line "#include &lt;android/window.h&gt;".</p>
</li>
<li>
<p dir="auto">In QtCreator I edited the .pro file, in the editor section I clicked with the secondary button to make the contextual menu appear, I chose "Add Library...", I chose "System Library", I clicked on "Browse...", I chose the file [...]/android-ndk-r9c/platforms/android-19/arch-arm/usr/lib/libandroid.so<br />
I clicked on "Next", a dialog was shown saying "The following snippet will be added to [...]", I clicked on "Finish" and, finally, this line was added to the .pro file:</p>
</li>
</ol>
<p dir="auto">unix|win32: LIBS += -landroid</p>
]]></description><link>https://forum.qt.io/post/201255</link><guid isPermaLink="true">https://forum.qt.io/post/201255</guid><dc:creator><![CDATA[Ganton]]></dc:creator><pubDate>Thu, 27 Mar 2014 19:32:23 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED]How to keep the backlight on(Android)? on Fri, 21 Jun 2013 06:08:00 GMT]]></title><description><![CDATA[<p dir="auto">You are missing some libraries in the .pro file probably.</p>
<p dir="auto">LIBS += -L$$PWD/../../android-ndk-r8d/platforms/android-14/arch-arm/usr/lib/ -landroid</p>
<p dir="auto">INCLUDEPATH += $$PWD/../../android-ndk-r8d/platforms/android-14/arch-arm/usr/include/android<br />
DEPENDPATH += $$PWD/../../android-ndk-r8d/platforms/android-14/arch-arm/usr/include/android</p>
<p dir="auto">You need to replace them with your corresponing directory. I hope that this is enough</p>
<p dir="auto">For the anative window flags you might need to include &lt;window.h&gt;</p>
]]></description><link>https://forum.qt.io/post/183684</link><guid isPermaLink="true">https://forum.qt.io/post/183684</guid><dc:creator><![CDATA[Moster]]></dc:creator><pubDate>Fri, 21 Jun 2013 06:08:00 GMT</pubDate></item></channel></rss>