Share via


AccountManager.GetAccounts Method

Definition

Lists all accounts visible to the caller regardless of type.

[Android.Runtime.Register("getAccounts", "()[Landroid/accounts/Account;", "GetGetAccountsHandler")]
[Android.Runtime.RequiresPermission("android.permission.GET_ACCOUNTS")]
public virtual Android.Accounts.Account[] GetAccounts ();
[<Android.Runtime.Register("getAccounts", "()[Landroid/accounts/Account;", "GetGetAccountsHandler")>]
[<Android.Runtime.RequiresPermission("android.permission.GET_ACCOUNTS")>]
abstract member GetAccounts : unit -> Android.Accounts.Account[]
override this.GetAccounts : unit -> Android.Accounts.Account[]

Returns

An array of Account, one for each account. Empty (never null) if no accounts have been added.

Attributes

Remarks

Lists all accounts visible to the caller regardless of type. Equivalent to getAccountsByType(null). These accounts may be visible because the user granted access to the account, or the AbstractAccountAuthenticator managing the account did so or because the client shares a signature with the managing AbstractAccountAuthenticator.

<div class="caution">

<b>Caution: </b>This method returns personal and sensitive user data. If your app accesses, collects, uses, or shares personal and sensitive data, you must clearly disclose that fact to users. For apps published on Google Play, policies protecting user data require that you do the following:

<ul> <li>Disclose to the user how your app accesses, collects, uses, or shares personal and sensitive data. Learn more about acceptable disclosure and consent.</li> <li>Provide a privacy policy that describes your use of this data on- and off-device.</li> </ul>

To learn more, visit the Google Play Policy regarding user data.

</div>

It is safe to call this method from the main thread.

Java documentation for android.accounts.AccountManager.getAccounts().

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