Sdílet prostřednictvím


AccountManager.RemoveAccount Method

Definition

Overloads

RemoveAccount(Account, IAccountManagerCallback, Handler)

Removes an account from the AccountManager.

RemoveAccount(Account, Activity, IAccountManagerCallback, Handler)

Removes an account from the AccountManager.

RemoveAccount(Account, IAccountManagerCallback, Handler)

Removes an account from the AccountManager.

[Android.Runtime.Register("removeAccount", "(Landroid/accounts/Account;Landroid/accounts/AccountManagerCallback;Landroid/os/Handler;)Landroid/accounts/AccountManagerFuture;", "GetRemoveAccount_Landroid_accounts_Account_Landroid_accounts_AccountManagerCallback_Landroid_os_Handler_Handler")]
[Android.Runtime.RequiresPermission("android.permission.MANAGE_ACCOUNTS")]
public virtual Android.Accounts.IAccountManagerFuture? RemoveAccount (Android.Accounts.Account? account, Android.Accounts.IAccountManagerCallback? callback, Android.OS.Handler? handler);
[<Android.Runtime.Register("removeAccount", "(Landroid/accounts/Account;Landroid/accounts/AccountManagerCallback;Landroid/os/Handler;)Landroid/accounts/AccountManagerFuture;", "GetRemoveAccount_Landroid_accounts_Account_Landroid_accounts_AccountManagerCallback_Landroid_os_Handler_Handler")>]
[<Android.Runtime.RequiresPermission("android.permission.MANAGE_ACCOUNTS")>]
abstract member RemoveAccount : Android.Accounts.Account * Android.Accounts.IAccountManagerCallback * Android.OS.Handler -> Android.Accounts.IAccountManagerFuture
override this.RemoveAccount : Android.Accounts.Account * Android.Accounts.IAccountManagerCallback * Android.OS.Handler -> Android.Accounts.IAccountManagerFuture

Parameters

account
Account

The Account to remove

callback
IAccountManagerCallback

Callback to invoke when the request completes, null for no callback

handler
Handler

Handler identifying the callback thread, null for the main thread

Returns

An AccountManagerFuture which resolves to a Boolean, true if the account has been successfully removed

Attributes

Remarks

Removes an account from the AccountManager. Does nothing if the account does not exist. Does not delete the account from the server. The authenticator may have its own policies preventing account deletion, in which case the account will not be deleted.

This method requires the caller to have a signature match with the authenticator that manages the specified account.

<b>NOTE:</b> If targeting your app to work on API level 22 and before, MANAGE_ACCOUNTS permission is needed for those platforms. See docs for this function in API level 22.

This member is deprecated. use #removeAccount(Account, Activity, AccountManagerCallback, Handler) instead

Java documentation for android.accounts.AccountManager.removeAccount(android.accounts.Account, android.accounts.AccountManagerCallback<java.lang.Boolean>, android.os.Handler).

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

RemoveAccount(Account, Activity, IAccountManagerCallback, Handler)

Removes an account from the AccountManager.

[Android.Runtime.Register("removeAccount", "(Landroid/accounts/Account;Landroid/app/Activity;Landroid/accounts/AccountManagerCallback;Landroid/os/Handler;)Landroid/accounts/AccountManagerFuture;", "GetRemoveAccount_Landroid_accounts_Account_Landroid_app_Activity_Landroid_accounts_AccountManagerCallback_Landroid_os_Handler_Handler", ApiSince=22)]
[Android.Runtime.RequiresPermission("android.permission.MANAGE_ACCOUNTS")]
public virtual Android.Accounts.IAccountManagerFuture? RemoveAccount (Android.Accounts.Account? account, Android.App.Activity? activity, Android.Accounts.IAccountManagerCallback? callback, Android.OS.Handler? handler);
[<Android.Runtime.Register("removeAccount", "(Landroid/accounts/Account;Landroid/app/Activity;Landroid/accounts/AccountManagerCallback;Landroid/os/Handler;)Landroid/accounts/AccountManagerFuture;", "GetRemoveAccount_Landroid_accounts_Account_Landroid_app_Activity_Landroid_accounts_AccountManagerCallback_Landroid_os_Handler_Handler", ApiSince=22)>]
[<Android.Runtime.RequiresPermission("android.permission.MANAGE_ACCOUNTS")>]
abstract member RemoveAccount : Android.Accounts.Account * Android.App.Activity * Android.Accounts.IAccountManagerCallback * Android.OS.Handler -> Android.Accounts.IAccountManagerFuture
override this.RemoveAccount : Android.Accounts.Account * Android.App.Activity * Android.Accounts.IAccountManagerCallback * Android.OS.Handler -> Android.Accounts.IAccountManagerFuture

Parameters

account
Account

The Account to remove

activity
Activity

The Activity context to use for launching a new authenticator-defined sub-Activity to prompt the user to delete an account; used only to call startActivity(); if null, the prompt will not be launched directly, but the Intent may be returned to the caller instead

callback
IAccountManagerCallback

Callback to invoke when the request completes, null for no callback

handler
Handler

Handler identifying the callback thread, null for the main thread

Returns

An AccountManagerFuture which resolves to a Bundle with #KEY_BOOLEAN_RESULT if activity was specified and an account was removed or if active. If no activity was specified, the returned Bundle contains only #KEY_INTENT with the Intent needed to launch the actual account removal process, if authenticator needs the activity launch. If an error occurred, AccountManagerFuture#getResult() throws: <ul> <li> AuthenticatorException if no authenticator was registered for this account type or the authenticator failed to respond <li> OperationCanceledException if the operation was canceled for any reason, including the user canceling the creation process or adding accounts (of this type) has been disabled by policy </ul>

Attributes

Remarks

Removes an account from the AccountManager. Does nothing if the account does not exist. Does not delete the account from the server. The authenticator may have its own policies preventing account deletion, in which case the account will not be deleted.

This method may be called from any thread, but the returned AccountManagerFuture must not be used on the main thread.

This method requires the caller to have a signature match with the authenticator that manages the specified account.

<b>NOTE:</b> If targeting your app to work on API level 22 and before, MANAGE_ACCOUNTS permission is needed for those platforms. See docs for this function in API level 22.

Java documentation for android.accounts.AccountManager.removeAccount(android.accounts.Account, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler).

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