Difference between revisions of "Application:setKeepAwake"

From GiderosMobile
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
 
 
'''Available since:''' Gideros 2011.6<br/>
 
'''Available since:''' Gideros 2011.6<br/>
 +
'''Class:''' [[Application]]<br/>
 +
 
=== Description ===
 
=== Description ===
<translate><br />
+
Controls the screen dimming and device sleeping of the device.
Controls the screen dimming and device sleeping of the device. When the application has no touches as user input for some period,<br />
+
 
the system puts the device into a sleep state where the screen dims. However some applications have no input and controlled<br />
+
When the application has no touches as user input for some period, the system puts the device into a sleep state where the screen dims.
by accelerometer or gyroscope only. For these kind applications, the screen should be kept awake by calling this function<br />
+
 
with parameter [[[true]]].<br />
+
However some applications have no input and are controlled by accelerometer or gyroscope only. For these kind of applications, the screen should be kept awake by calling this function with parameter ''true''.
<br />
+
 
&lt;ul&gt;<br />
+
'''Note''': this function has no effect on desktop.
&lt;li&gt;*Note:** This function has no effect on desktop.&lt;/li&gt;<br />
+
 
&lt;/ul&gt;<br />
+
 
<br /></translate>
 
 
<source lang="lua">
 
<source lang="lua">
Application:setKeepAwake(keepAwake)
+
application:setKeepAwake(keepAwake)
 
</source>
 
</source>
 +
 
=== Parameters ===
 
=== Parameters ===
'''keepAwake''': (boolean) <translate>if true, screen is kept awake.</translate> <br/>
+
'''keepAwake''': (boolean) if true, screen is kept awake
 +
 
 
=== Examples ===
 
=== Examples ===
'''Example'''<br/>
+
<source lang="lua">
<source lang="lua">application:setKeepAwake(true) -- disable screen dimming and device sleeping
+
application:setKeepAwake(true) -- disable screen dimming and device sleeping
application:setKeepAwake(false) -- enable screen dimming and device sleeping</source>
+
application:setKeepAwake(false) -- enable screen dimming and device sleeping
 +
</source>
 +
 
 +
{{Application}}

Revision as of 00:41, 3 December 2019

Available since: Gideros 2011.6
Class: Application

Description

Controls the screen dimming and device sleeping of the device.

When the application has no touches as user input for some period, the system puts the device into a sleep state where the screen dims.

However some applications have no input and are controlled by accelerometer or gyroscope only. For these kind of applications, the screen should be kept awake by calling this function with parameter true.

Note: this function has no effect on desktop.


application:setKeepAwake(keepAwake)

Parameters

keepAwake: (boolean) if true, screen is kept awake

Examples

application:setKeepAwake(true) -- disable screen dimming and device sleeping
application:setKeepAwake(false) -- enable screen dimming and device sleeping