Freigeben über


AccountManager.GetUserData(Account, String) Method

Definition

Gets the user data named by "key" associated with the account.

[Android.Runtime.Register("getUserData", "(Landroid/accounts/Account;Ljava/lang/String;)Ljava/lang/String;", "GetGetUserData_Landroid_accounts_Account_Ljava_lang_String_Handler")]
[Android.Runtime.RequiresPermission("android.permission.AUTHENTICATE_ACCOUNTS")]
public virtual string? GetUserData (Android.Accounts.Account? account, string? key);
[<Android.Runtime.Register("getUserData", "(Landroid/accounts/Account;Ljava/lang/String;)Ljava/lang/String;", "GetGetUserData_Landroid_accounts_Account_Ljava_lang_String_Handler")>]
[<Android.Runtime.RequiresPermission("android.permission.AUTHENTICATE_ACCOUNTS")>]
abstract member GetUserData : Android.Accounts.Account * string -> string
override this.GetUserData : Android.Accounts.Account * string -> string

Parameters

account
Account

The account to query for user data

key
String

Returns

The user data, null if the account, key doesn't exist, or the user is locked

Attributes

Remarks

Gets the user data named by "key" associated with the account. This is intended for authenticators and related code to store arbitrary metadata along with accounts. The meaning of the keys and values is up to the authenticator for the account.

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 owns the specified account.

<b>NOTE:</b> If targeting your app to work on API level android.os.Build.VERSION_CODES#LOLLIPOP_MR1 and before, AUTHENTICATE_ACCOUNTS permission is needed for those platforms. See docs for this function in API level android.os.Build.VERSION_CODES#LOLLIPOP_MR1.

Java documentation for android.accounts.AccountManager.getUserData(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