Share via


DevicePolicyManager.SetMaximumTimeToLock(ComponentName, Int64) Method

Definition

Called by an application that is administering the device to set the maximum time for user activity until the device will lock.

[Android.Runtime.Register("setMaximumTimeToLock", "(Landroid/content/ComponentName;J)V", "GetSetMaximumTimeToLock_Landroid_content_ComponentName_JHandler")]
[Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_LOCK")]
public virtual void SetMaximumTimeToLock (Android.Content.ComponentName? admin, long timeMs);
[<Android.Runtime.Register("setMaximumTimeToLock", "(Landroid/content/ComponentName;J)V", "GetSetMaximumTimeToLock_Landroid_content_ComponentName_JHandler")>]
[<Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_LOCK")>]
abstract member SetMaximumTimeToLock : Android.Content.ComponentName * int64 -> unit
override this.SetMaximumTimeToLock : Android.Content.ComponentName * int64 -> unit

Parameters

admin
ComponentName

Which DeviceAdminReceiver this request is associated with. Null if the caller is not a device admin

timeMs
Int64

The new desired maximum time to lock in milliseconds. A value of 0 means there is no restriction.

Attributes

Remarks

Called by an application that is administering the device to set the maximum time for user activity until the device will lock. This limits the length that the user can set. It takes effect immediately.

A calling device admin must have requested DeviceAdminInfo#USES_POLICY_FORCE_LOCK to be able to call this method; if it has not, a security exception will be thrown.

This method can be called on the DevicePolicyManager instance returned by #getParentProfileInstance(ComponentName) in order to set restrictions on the parent profile.

Java documentation for android.app.admin.DevicePolicyManager.setMaximumTimeToLock(android.content.ComponentName, 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