DevicePolicyManager.SetPasswordExpirationTimeout(ComponentName, Int64) Method

Definition

Called by a device admin to set the password expiration timeout.

[Android.Runtime.Register("setPasswordExpirationTimeout", "(Landroid/content/ComponentName;J)V", "GetSetPasswordExpirationTimeout_Landroid_content_ComponentName_JHandler")]
[Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_LOCK_CREDENTIALS")]
public virtual void SetPasswordExpirationTimeout (Android.Content.ComponentName? admin, long timeout);
[<Android.Runtime.Register("setPasswordExpirationTimeout", "(Landroid/content/ComponentName;J)V", "GetSetPasswordExpirationTimeout_Landroid_content_ComponentName_JHandler")>]
[<Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_LOCK_CREDENTIALS")>]
abstract member SetPasswordExpirationTimeout : Android.Content.ComponentName * int64 -> unit
override this.SetPasswordExpirationTimeout : Android.Content.ComponentName * int64 -> unit

Parameters

admin
ComponentName

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

timeout
Int64

The limit (in ms) that a password can remain in effect. A value of 0 means there is no restriction (unlimited).

Attributes

Remarks

Called by a device admin to set the password expiration timeout. Calling this method will restart the countdown for password expiration for the given admin, as will changing the device password (for all admins).

The provided timeout is the time delta in ms and will be added to the current time. For example, to have the password expire 5 days from now, timeout would be 5 * 86400 * 1000 = 432000000 ms for timeout.

To disable password expiration, a value of 0 may be used for timeout.

On devices not supporting PackageManager#FEATURE_SECURE_LOCK_SCREEN feature, the password expiration is always disabled.

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

Note that setting the password will automatically reset the expiration time for all active admins. Active admins do not need to explicitly call this method in that case.

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.setPasswordExpirationTimeout(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