DevicePolicyManager.SetMaximumFailedPasswordsForWipe Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Setting this to a value greater than zero enables a policy that will perform a device or profile wipe after too many incorrect device-unlock passwords have been entered.
[Android.Runtime.Register("setMaximumFailedPasswordsForWipe", "(Landroid/content/ComponentName;I)V", "GetSetMaximumFailedPasswordsForWipe_Landroid_content_ComponentName_IHandler")]
[Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_WIPE_DATA")]
public virtual void SetMaximumFailedPasswordsForWipe (Android.Content.ComponentName? admin, int num);
[<Android.Runtime.Register("setMaximumFailedPasswordsForWipe", "(Landroid/content/ComponentName;I)V", "GetSetMaximumFailedPasswordsForWipe_Landroid_content_ComponentName_IHandler")>]
[<Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_WIPE_DATA")>]
abstract member SetMaximumFailedPasswordsForWipe : Android.Content.ComponentName * int -> unit
override this.SetMaximumFailedPasswordsForWipe : Android.Content.ComponentName * int -> unit
Parameters
- admin
- ComponentName
Which DeviceAdminReceiver
this request is associated with. Null if the
caller is not a device admin.
- num
- Int32
The number of failed password attempts at which point the device or profile will be wiped.
- Attributes
Remarks
Setting this to a value greater than zero enables a policy that will perform a device or profile wipe after too many incorrect device-unlock passwords have been entered. This policy combines watching for failed passwords and wiping the device, and requires that calling Device Admins request both DeviceAdminInfo#USES_POLICY_WATCH_LOGIN
and DeviceAdminInfo#USES_POLICY_WIPE_DATA
}.
When this policy is set on the system or the main user, the device will be factory reset after too many incorrect password attempts. When set on any other user, only the corresponding user or profile will be wiped.
To implement any other policy (e.g. wiping data for a particular application only, erasing or revoking credentials, or reporting the failure to a server), you should implement DeviceAdminReceiver#onPasswordFailed(Context, android.content.Intent)
instead. Do not use this API, because if the maximum count is reached, the device or profile will be wiped immediately, and your callback will not be invoked.
This method can be called on the DevicePolicyManager
instance returned by #getParentProfileInstance(ComponentName)
in order to set a value on the parent profile.
On devices not supporting PackageManager#FEATURE_SECURE_LOCK_SCREEN
feature, the password is always empty and this method has no effect - i.e. the policy is not set.
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.