Share via


PowerManager.IWakeLockStateListener.OnStateChanged(Boolean) Method

Definition

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.

[Android.Runtime.Register("onStateChanged", "(Z)V", "GetOnStateChanged_ZHandler:Android.OS.PowerManager/IWakeLockStateListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=33)]
public void OnStateChanged (bool enabled);
[<Android.Runtime.Register("onStateChanged", "(Z)V", "GetOnStateChanged_ZHandler:Android.OS.PowerManager/IWakeLockStateListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=33)>]
abstract member OnStateChanged : bool -> unit

Parameters

enabled
Boolean

true is enabled, false is disabled.

Attributes

Remarks

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.

Java documentation for android.os.PowerManager.WakeLockStateListener.onStateChanged(boolean).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to