共用方式為


DevicePolicyManager.WipeData Method

Definition

Overloads

WipeData(WipeDataFlags)

See #wipeData(int, CharSequence)

WipeData(WipeDataFlags, ICharSequence)

Ask that all user data be wiped.

WipeData(WipeDataFlags, String)

Ask that all user data be wiped.

WipeData(WipeDataFlags)

See #wipeData(int, CharSequence)

[Android.Runtime.Register("wipeData", "(I)V", "GetWipeData_IHandler")]
[Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_WIPE_DATA")]
public virtual void WipeData (Android.App.Admin.WipeDataFlags flags);
[<Android.Runtime.Register("wipeData", "(I)V", "GetWipeData_IHandler")>]
[<Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_WIPE_DATA")>]
abstract member WipeData : Android.App.Admin.WipeDataFlags -> unit
override this.WipeData : Android.App.Admin.WipeDataFlags -> unit

Parameters

flags
WipeDataFlags

Bit mask of additional options: currently supported flags are #WIPE_EXTERNAL_STORAGE, #WIPE_RESET_PROTECTION_DATA, #WIPE_EUICC and #WIPE_SILENTLY.

Attributes

Remarks

See #wipeData(int, CharSequence)

Java documentation for android.app.admin.DevicePolicyManager.wipeData(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

WipeData(WipeDataFlags, ICharSequence)

Ask that all user data be wiped.

[Android.Runtime.Register("wipeData", "(ILjava/lang/CharSequence;)V", "GetWipeData_ILjava_lang_CharSequence_Handler", ApiSince=28)]
[Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_WIPE_DATA")]
public virtual void WipeData (Android.App.Admin.WipeDataFlags flags, Java.Lang.ICharSequence reason);
[<Android.Runtime.Register("wipeData", "(ILjava/lang/CharSequence;)V", "GetWipeData_ILjava_lang_CharSequence_Handler", ApiSince=28)>]
[<Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_WIPE_DATA")>]
abstract member WipeData : Android.App.Admin.WipeDataFlags * Java.Lang.ICharSequence -> unit
override this.WipeData : Android.App.Admin.WipeDataFlags * Java.Lang.ICharSequence -> unit

Parameters

flags
WipeDataFlags

Bit mask of additional options: currently supported flags are #WIPE_EXTERNAL_STORAGE, #WIPE_RESET_PROTECTION_DATA and #WIPE_EUICC.

reason
ICharSequence

a string that contains the reason for wiping data, which can be presented to the user.

Attributes

Remarks

Ask that all user data be wiped.

If called as a secondary user or managed profile, the user itself and its associated user data will be wiped. In particular, If the caller is a profile owner of an organization-owned managed profile, calling this method will relinquish the device for personal use, removing the managed profile and all policies set by the profile owner.

Calling this method from the primary user will only work if the calling app is targeting SDK level Build.VERSION_CODES#TIRAMISU or below, in which case it will cause the device to reboot, erasing all device data - including all the secondary users and their data - while booting up. If an app targeting SDK level Build.VERSION_CODES#UPSIDE_DOWN_CAKE and above is calling this method from the primary user or last full user, IllegalStateException will be thrown.

If an app wants to wipe the entire device irrespective of which user they are from, they should use #wipeDevice instead.

Java documentation for android.app.admin.DevicePolicyManager.wipeData(int, java.lang.CharSequence).

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

WipeData(WipeDataFlags, String)

Ask that all user data be wiped.

public void WipeData (Android.App.Admin.WipeDataFlags flags, string reason);
member this.WipeData : Android.App.Admin.WipeDataFlags * string -> unit

Parameters

flags
WipeDataFlags

Bit mask of additional options: currently supported flags are #WIPE_EXTERNAL_STORAGE, #WIPE_RESET_PROTECTION_DATA and #WIPE_EUICC.

reason
String

a string that contains the reason for wiping data, which can be presented to the user.

Remarks

Ask that all user data be wiped.

If called as a secondary user or managed profile, the user itself and its associated user data will be wiped. In particular, If the caller is a profile owner of an organization-owned managed profile, calling this method will relinquish the device for personal use, removing the managed profile and all policies set by the profile owner.

Calling this method from the primary user will only work if the calling app is targeting SDK level Build.VERSION_CODES#TIRAMISU or below, in which case it will cause the device to reboot, erasing all device data - including all the secondary users and their data - while booting up. If an app targeting SDK level Build.VERSION_CODES#UPSIDE_DOWN_CAKE and above is calling this method from the primary user or last full user, IllegalStateException will be thrown.

If an app wants to wipe the entire device irrespective of which user they are from, they should use #wipeDevice instead.

Java documentation for android.app.admin.DevicePolicyManager.wipeData(int, java.lang.CharSequence).

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