Dela via


AccountManager.SetUserData(Account, String, String) Method

Definition

Sets one userdata key for an account.

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

Parameters

account
Account

Account whose user data is to be set. Must not be null.

key
String

String user data key to set. Must not be null

value
String

String value to set, null to clear this user data key

Attributes

Remarks

Sets one userdata key for an account. Intended by use for the authenticator to stash state for itself, not directly by applications. The meaning of the keys and values is up to the authenticator.

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.setUserData(android.accounts.Account, java.lang.String, 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