Stay organized with collections
Save and categorize content based on your preferences.
LightsSession
abstract class LightsSession : AutoCloseable
Encapsulates a session that can be used to control device lights and represents the lifetime of the requests.
Any lights requests always live in a lights session which defines the lifecycle of the lights requests. A lights session is AutoCloseable that will get closed when leaving the session context.
Multiple sessions can make lights requests which contains same light. In the case the LightsManager implementation will arbitrate and honor one of the session's request. When the session hold the current light request closed, LightsManager implementation will choose another live session to honor its lights requests.
Summary
Public methods |
abstract Unit |
|
abstract Unit |
Sends a request to modify the states of multiple lights.
|
Public methods
close
abstract fun close(): Unit
Exceptions |
java.lang.Exception |
if this resource cannot be closed |
requestLights
abstract fun requestLights(request: LightsRequest): Unit
Sends a request to modify the states of multiple lights.
Parameters |
request |
LightsRequest: the settings for lights that should change This value cannot be null . |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# LightsManager.LightsSession\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nLightsSession\n=============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/hardware/lights/LightsManager.LightsSession \"View this page in Java\") \n\n```\nabstract class LightsSession : AutoCloseable\n```\n\n|---|----------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.hardware.lights.LightsManager.LightsSession](#) |\n\nEncapsulates a session that can be used to control device lights and represents the lifetime of the requests.\n\nAny lights requests always live in a lights session which defines the lifecycle of the lights requests. A lights session is AutoCloseable that will get closed when leaving the session context.\n\nMultiple sessions can make lights requests which contains same light. In the case the LightsManager implementation will arbitrate and honor one of the session's request. When the session hold the current light request closed, LightsManager implementation will choose another live session to honor its lights requests.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [close](#close())`()` \u003cbr /\u003e |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [requestLights](#requestLights(android.hardware.lights.LightsRequest))`(`request:` `[LightsRequest](/reference/kotlin/android/hardware/lights/LightsRequest)`)` Sends a request to modify the states of multiple lights. |\n\nPublic methods\n--------------\n\n### close\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun close(): Unit\n```\n\n| Exceptions ||\n|-----------------------|-----------------------------------|\n| `java.lang.Exception` | if this resource cannot be closed |\n\n### requestLights\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun requestLights(request: LightsRequest): Unit\n```\n\nSends a request to modify the states of multiple lights.\n\n| Parameters ||\n|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------|\n| `request` | [LightsRequest](/reference/kotlin/android/hardware/lights/LightsRequest): the settings for lights that should change This value cannot be `null`. |"]]