Difference between revisions of "Application:setKeepAwake"
From GiderosMobile
m (Text replacement - "</source" to "</syntaxhighlight") |
|||
(10 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
'''Available since:''' Gideros 2011.6<br/> | '''Available since:''' Gideros 2011.6<br/> | ||
+ | '''Class:''' [[Application]]<br/> | ||
+ | |||
=== Description === | === Description === | ||
− | + | 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, | + | |
− | the system puts the device into a sleep state where the screen dims. However some applications have no input and controlled | + | 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 | + | |
− | with parameter | + | 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) |
− | + | </syntaxhighlight> | |
− | </ | + | |
=== Parameters === | === Parameters === | ||
− | '''keepAwake''': (boolean) if true, screen is kept awake | + | '''keepAwake''': (boolean) if true, screen is kept awake |
+ | |||
=== Examples === | === Examples === | ||
− | + | <syntaxhighlight lang="lua"> | |
− | + | 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 |
+ | </syntaxhighlight> | ||
+ | |||
+ | {{Application}} |
Latest revision as of 17:14, 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.
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
- Application:applyStyles
- Application:canOpenUrl
- Application:checkPermission
- Application:configureFrustum
- Application:enableDrawInfo
- Application:enableOnDemandDraw
- Application:exit
- Application:get
- Application:getApiVersion
- Application:getAppId
- Application:getBackgroundColor
- Application:getClipboard
- Application:getContentHeight
- Application:getContentWidth
- Application:getDeviceHeight
- Application:getDeviceInfo
- Application:getDeviceName
- Application:getDeviceOrientation
- Application:getDeviceSafeArea
- Application:getDeviceWidth
- Application:getFps
- Application:getKeyboardModifiers
- Application:getLanguage
- Application:getLocale
- Application:getLogicalBounds
- Application:getLogicalHeight
- Application:getLogicalScaleX
- Application:getLogicalScaleY
- Application:getLogicalTranslateX
- Application:getLogicalTranslateY
- Application:getLogicalWidth
- Application:getNativePath
- Application:getOrientation
- Application:getProjectProperties
- Application:getScaleMode
- Application:getScreenDensity
- Application:getTextureMemoryUsage
- Application:isPlayerMode
- Application:openUrl
- Application:requestPermissions
- Application:set
- Application:setBackgroundColor
- Application:setClipboard
- Application:setEventMerging
- Application:setFps
- Application:setFullScreen
- Application:setKeepAwake
- Application:setKeyboardVisibility
- Application:setLogicalDimensions
- Application:setOrientation
- Application:setScaleMode
- Application:setTextInput
- Application:setWindowSize
- Application:vibrate