Freigeben über


AccountManager.SetAccountVisibility Method

Definition

Set visibility value of given account to certain package.

[Android.Runtime.Register("setAccountVisibility", "(Landroid/accounts/Account;Ljava/lang/String;I)Z", "GetSetAccountVisibility_Landroid_accounts_Account_Ljava_lang_String_IHandler", ApiSince=26)]
public virtual bool SetAccountVisibility (Android.Accounts.Account? account, string? packageName, Android.Accounts.AccountVisibility visibility);
[<Android.Runtime.Register("setAccountVisibility", "(Landroid/accounts/Account;Ljava/lang/String;I)Z", "GetSetAccountVisibility_Landroid_accounts_Account_Ljava_lang_String_IHandler", ApiSince=26)>]
abstract member SetAccountVisibility : Android.Accounts.Account * string * Android.Accounts.AccountVisibility -> bool
override this.SetAccountVisibility : Android.Accounts.Account * string * Android.Accounts.AccountVisibility -> bool

Parameters

account
Account

Account to update visibility

packageName
String

Package name of the application to modify account visibility. Declaring package visibility needs for it is needed, if the caller is targeting API level 34 and above.

visibility
AccountVisibility

New visibility value

Returns

True, if visibility value was successfully updated.

Attributes

Remarks

Set visibility value of given account to certain package. Package name must match installed application, or be equal to #PACKAGE_NAME_KEY_LEGACY_VISIBLE or #PACKAGE_NAME_KEY_LEGACY_NOT_VISIBLE.

Possible visibility values: <ul> <li>#VISIBILITY_UNDEFINED</li> <li>#VISIBILITY_VISIBLE</li> <li>#VISIBILITY_USER_MANAGED_VISIBLE</li> <li>#VISIBILITY_NOT_VISIBLE<li>#VISIBILITY_USER_MANAGED_NOT_VISIBLE</li> </ul>

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

Java documentation for android.accounts.AccountManager.setAccountVisibility(android.accounts.Account, java.lang.String, 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