Stay organized with collections
Save and categorize content based on your preferences.
PowerManager.WakeLockStateListener
public
static
interface
PowerManager.WakeLockStateListener
android.os.PowerManager.WakeLockStateListener
|
A listener interface to get notified when the wakelock is enabled/disabled.
Summary
Public methods |
abstract
void
|
onStateChanged(boolean enabled)
Frameworks could disable the wakelock because either device's power allowlist has
changed, or the app's wakelock has exceeded its quota, or the app goes into cached
state.
|
Public methods
onStateChanged
public abstract void onStateChanged (boolean enabled)
Frameworks could disable the wakelock because either device's power allowlist has
changed, or the app's wakelock has exceeded its quota, or the app goes into cached
state.
This callback is called whenever the wakelock's state has changed.
Parameters |
enabled |
boolean : true is enabled, false is disabled. |
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,["# PowerManager.WakeLockStateListener\n\nAdded in [API level 33](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nPowerManager.WakeLockStateListener\n==================================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/os/PowerManager.WakeLockStateListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nPowerManager.WakeLockStateListener\n`\n\n\n`\n\n\n`\n\n|-----------------------------------------------|\n| android.os.PowerManager.WakeLockStateListener |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nA listener interface to get notified when the wakelock is enabled/disabled.\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[onStateChanged](/reference/android/os/PowerManager.WakeLockStateListener#onStateChanged(boolean))`(boolean enabled) ` Frameworks could disable the wakelock because either device's power allowlist has changed, or the app's wakelock has exceeded its quota, or the app goes into cached state. |\n\nPublic methods\n--------------\n\n### onStateChanged\n\nAdded in [API level 33](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onStateChanged (boolean enabled)\n```\n\nFrameworks could disable the wakelock because either device's power allowlist has\nchanged, or the app's wakelock has exceeded its quota, or the app goes into cached\nstate.\n\n\nThis callback is called whenever the wakelock's state has changed.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------|-------------------------------------------------------|\n| `enabled` | `boolean`: true is enabled, false is disabled. \u003cbr /\u003e |"]]