PowerManager.GoToSleep(Int64) Method

Definition

Forces the android.view.Display#DEFAULT_DISPLAY_GROUP default display group to turn off.

[Android.Runtime.Register("goToSleep", "(J)V", "GetGoToSleep_JHandler")]
public virtual void GoToSleep (long time);
[<Android.Runtime.Register("goToSleep", "(J)V", "GetGoToSleep_JHandler")>]
abstract member GoToSleep : int64 -> unit
override this.GoToSleep : int64 -> unit

Parameters

time
Int64

The time when the request to go to sleep was issued, in the SystemClock#uptimeMillis() time base. This timestamp is used to correctly order the go to sleep request with other power management functions. It should be set to the timestamp of the input event that caused the request to go to sleep.

Attributes

Remarks

Forces the android.view.Display#DEFAULT_DISPLAY_GROUP default display group to turn off.

If the android.view.Display#DEFAULT_DISPLAY_GROUP default display group is turned on it will be turned off. If all displays are off as a result of this action the device will be put to sleep. If the android.view.Display#DEFAULT_DISPLAY_GROUP default display group is already off then nothing will happen.

If the device is an Android TV playback device and the current active source on the HDMI-connected TV, it will attempt to turn off that TV via HDMI-CEC.

Overrides all the wake locks that are held. This is what happens when the power key is pressed to turn off the screen.

Requires the android.Manifest.permission#DEVICE_POWER permission.

Java documentation for android.os.PowerManager.goToSleep(long).

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

See also

  • <xref:Android.OS.PowerManager.UserActivity(System.Int64%2c+System.Boolean)>
  • WakeUp(Int64)