Share via


DevicePolicyManager.SetPasswordMinimumNonLetter(ComponentName, Int32) Method

Definition

Called by an application that is administering the device to set the minimum number of non-letter characters (numerical digits or symbols) required in the password.

[Android.Runtime.Register("setPasswordMinimumNonLetter", "(Landroid/content/ComponentName;I)V", "GetSetPasswordMinimumNonLetter_Landroid_content_ComponentName_IHandler")]
public virtual void SetPasswordMinimumNonLetter (Android.Content.ComponentName admin, int length);
[<Android.Runtime.Register("setPasswordMinimumNonLetter", "(Landroid/content/ComponentName;I)V", "GetSetPasswordMinimumNonLetter_Landroid_content_ComponentName_IHandler")>]
abstract member SetPasswordMinimumNonLetter : Android.Content.ComponentName * int -> unit
override this.SetPasswordMinimumNonLetter : Android.Content.ComponentName * int -> unit

Parameters

admin
ComponentName

Which DeviceAdminReceiver this request is associated with.

length
Int32

The new desired minimum number of letters required in the password. A value of 0 means there is no restriction.

Attributes

Remarks

Called by an application that is administering the device to set the minimum number of non-letter characters (numerical digits or symbols) required in the password. After setting this, the user will not be able to enter a new password that is not at least as restrictive as what has been set. Note that the current password will remain until the user has set a new one, so the change does not take place immediately. To prompt the user for a new password, use #ACTION_SET_NEW_PASSWORD or #ACTION_SET_NEW_PARENT_PROFILE_PASSWORD after setting this value. This constraint is only imposed if the administrator has also requested #PASSWORD_QUALITY_COMPLEX with #setPasswordQuality. If an app targeting SDK level android.os.Build.VERSION_CODES#R and above enforces this constraint without settings password quality to #PASSWORD_QUALITY_COMPLEX first, this method will throw IllegalStateException. The default value is 0.

On devices not supporting PackageManager#FEATURE_SECURE_LOCK_SCREEN feature, the password is always treated as empty.

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

Apps targeting android.os.Build.VERSION_CODES#R and below can call this method on the DevicePolicyManager instance returned by #getParentProfileInstance(ComponentName) in order to set restrictions on the parent profile.

<string>Note:</strong> this method is ignored on {PackageManager#FEATURE_AUTOMOTIVE automotive builds}.

This member is deprecated. see #setPasswordQuality(ComponentName, int) for details.

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