MediaPlayer.SetWakeMode(Context, WakeLockFlags) Method

Definition

Set the low-level power management behavior for this MediaPlayer.

[Android.Runtime.Register("setWakeMode", "(Landroid/content/Context;I)V", "GetSetWakeMode_Landroid_content_Context_IHandler")]
public virtual void SetWakeMode (Android.Content.Context? context, Android.OS.WakeLockFlags mode);
[<Android.Runtime.Register("setWakeMode", "(Landroid/content/Context;I)V", "GetSetWakeMode_Landroid_content_Context_IHandler")>]
abstract member SetWakeMode : Android.Content.Context * Android.OS.WakeLockFlags -> unit
override this.SetWakeMode : Android.Content.Context * Android.OS.WakeLockFlags -> unit

Parameters

context
Context

the Context to use

mode
WakeLockFlags

the power/wake mode to set

Attributes

Remarks

Set the low-level power management behavior for this MediaPlayer. This can be used when the MediaPlayer is not playing through a SurfaceHolder set with #setDisplay(SurfaceHolder) and thus can use the high-level #setScreenOnWhilePlaying(boolean) feature.

This function has the MediaPlayer access the low-level power manager service to control the device's power usage while playing is occurring. The parameter is a combination of android.os.PowerManager wake flags. Use of this method requires android.Manifest.permission#WAKE_LOCK permission. By default, no attempt is made to keep the device awake during playback.

Java documentation for android.media.MediaPlayer.setWakeMode(android.content.Context, int).

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