다음을 통해 공유


PowerManager.WakeLock.SetWorkSource(WorkSource) Method

Definition

Sets the work source associated with the wake lock.

[Android.Runtime.Register("setWorkSource", "(Landroid/os/WorkSource;)V", "GetSetWorkSource_Landroid_os_WorkSource_Handler")]
public virtual void SetWorkSource (Android.OS.WorkSource? ws);
[<Android.Runtime.Register("setWorkSource", "(Landroid/os/WorkSource;)V", "GetSetWorkSource_Landroid_os_WorkSource_Handler")>]
abstract member SetWorkSource : Android.OS.WorkSource -> unit
override this.SetWorkSource : Android.OS.WorkSource -> unit

Parameters

ws
WorkSource

The work source, or null if none.

Attributes

Remarks

Sets the work source associated with the wake lock.

The work source is used to determine on behalf of which application the wake lock is being held. This is useful in the case where a service is performing work on behalf of an application so that the cost of that work can be accounted to the application.

Make sure to follow the tag naming convention when using WorkSource to make it easier for app developers to understand wake locks attributed to them. See PowerManager#newWakeLock(int, String) documentation.

Java documentation for android.os.PowerManager.WakeLock.setWorkSource(android.os.WorkSource).

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