AccountManager.GetAccountsByTypeForPackage(String, String) Method

Definition

Returns the accounts visible to the specified package in an environment where some apps are not authorized to view all accounts.

[Android.Runtime.Register("getAccountsByTypeForPackage", "(Ljava/lang/String;Ljava/lang/String;)[Landroid/accounts/Account;", "GetGetAccountsByTypeForPackage_Ljava_lang_String_Ljava_lang_String_Handler")]
public virtual Android.Accounts.Account[] GetAccountsByTypeForPackage (string? type, string? packageName);
[<Android.Runtime.Register("getAccountsByTypeForPackage", "(Ljava/lang/String;Ljava/lang/String;)[Landroid/accounts/Account;", "GetGetAccountsByTypeForPackage_Ljava_lang_String_Ljava_lang_String_Handler")>]
abstract member GetAccountsByTypeForPackage : string * string -> Android.Accounts.Account[]
override this.GetAccountsByTypeForPackage : string * string -> Android.Accounts.Account[]

Parameters

type
String

The type of accounts to return, null to retrieve all accounts

packageName
String

The package name of the app for which the accounts are to be returned

Returns

An array of Account, one per matching account. Empty (never null) if no accounts of the specified type can be accessed by the package.

Attributes

Remarks

Returns the accounts visible to the specified package in an environment where some apps are not authorized to view all accounts. This method can only be called by system apps and authenticators managing the type. Beginning API level android.os.Build.VERSION_CODES#O it also return accounts which user can make visible to the application (see #VISIBILITY_USER_MANAGED_VISIBLE).

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