Difference between revisions of "Application:setKeepAwake"

From GiderosMobile
m (Text replacement - "<source" to "<syntaxhighlight")
Line 12: Line 12:
  
  
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
application:setKeepAwake(keepAwake)
 
application:setKeepAwake(keepAwake)
 
</source>
 
</source>
Line 20: Line 20:
  
 
=== Examples ===
 
=== Examples ===
<source lang="lua">
+
<syntaxhighlight 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
 
application:setKeepAwake(false) -- enable screen dimming and device sleeping

Revision as of 16:54, 12 July 2023

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.


<syntaxhighlight lang="lua"> application:setKeepAwake(keepAwake) </source>

Parameters

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

Examples

<syntaxhighlight lang="lua"> application:setKeepAwake(true) -- disable screen dimming and device sleeping application:setKeepAwake(false) -- enable screen dimming and device sleeping </source>