AccountManager.SetPassword(Account, String) Method

Definition

Sets or forgets a saved password.

[Android.Runtime.Register("setPassword", "(Landroid/accounts/Account;Ljava/lang/String;)V", "GetSetPassword_Landroid_accounts_Account_Ljava_lang_String_Handler")]
[Android.Runtime.RequiresPermission("android.permission.AUTHENTICATE_ACCOUNTS")]
public virtual void SetPassword (Android.Accounts.Account? account, string? password);
[<Android.Runtime.Register("setPassword", "(Landroid/accounts/Account;Ljava/lang/String;)V", "GetSetPassword_Landroid_accounts_Account_Ljava_lang_String_Handler")>]
[<Android.Runtime.RequiresPermission("android.permission.AUTHENTICATE_ACCOUNTS")>]
abstract member SetPassword : Android.Accounts.Account * string -> unit
override this.SetPassword : Android.Accounts.Account * string -> unit

Parameters

account
Account

The account whose password is to be set. Cannot be null.

password
String

The password to set, null to clear the password

Attributes

Remarks

Sets or forgets a saved password. This modifies the local copy of the password used to automatically authenticate the user; it does not change the user's account password on the server. Intended for use by the authenticator, not directly by applications.

Calling this method does not update the last authenticated timestamp, referred by #KEY_LAST_AUTHENTICATED_TIME. To update it, call #notifyAccountAuthenticated(Account) after getting success.

It is safe to call this method from 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, AUTHENTICATE_ACCOUNTS permission and same UID as account's authenticator is needed for those platforms. See docs for this function in API level 22.

Java documentation for android.accounts.AccountManager.setPassword(android.accounts.Account, java.lang.String).

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