/**@class android.accounts.AccountManager
@extends java.lang.Object
This class provides access to a centralized registry of the user's
online accounts. The user enters credentials (username and password) once
per account, granting applications access to online resources with
"one-click" approval.
<p>Different online services have different ways of handling accounts and
authentication, so the account manager uses pluggable <em>authenticator</em>
modules for different <em>account types</em>. Authenticators (which may be
written by third parties) handle the actual details of validating account
credentials and storing account information. For example, Google, Facebook,
and Microsoft Exchange each have their own authenticator.
<p>Many servers support some notion of an <em>authentication token</em>,
which can be used to authenticate a request to the server without sending
the user's actual password. (Auth tokens are normally created with a
separate request which does include the user's credentials.) AccountManager
can generate auth tokens for applications, so the application doesn't need to
handle passwords directly. Auth tokens are normally reusable and cached by
AccountManager, but must be refreshed periodically. It's the responsibility
of applications to <em>invalidate</em> auth tokens when they stop working so
the AccountManager knows it needs to regenerate them.
<p>Applications accessing a server normally go through these steps:
<ul>
<li>Get an instance of AccountManager using {@link #get}(Context).
<li>List the available accounts using {@link #getAccountsByType} or
{@link #getAccountsByTypeAndFeatures}. Normally applications will only
be interested in accounts with one particular <em>type</em>, which
identifies the authenticator. Account <em>features</em> are used to
identify particular account subtypes and capabilities. Both the account
type and features are authenticator-specific strings, and must be known by
the application in coordination with its preferred authenticators.
<li>Select one or more of the available accounts, possibly by asking the
user for their preference. If no suitable accounts are available,
{@link #addAccount} may be called to prompt the user to create an
account of the appropriate type.
<li><b>Important:</b> If the application is using a previously remembered
account selection, it must make sure the account is still in the list
of accounts returned by {@link #getAccountsByType}. Requesting an auth token
for an account no longer on the device results in an undefined failure.
<li>Request an auth token for the selected account(s) using one of the
{@link #getAuthToken} methods or related helpers. Refer to the description
of each method for exact usage and error handling details.
<li>Make the request using the auth token. The form of the auth token,
the format of the request, and the protocol used are all specific to the
service you are accessing. The application may use whatever network and
protocol libraries are useful.
<li><b>Important:</b> If the request fails with an authentication error,
it could be that a cached auth token is stale and no longer honored by
the server. The application must call {@link #invalidateAuthToken} to remove
the token from the cache, otherwise requests will continue failing! After
invalidating the auth token, immediately go back to the "Request an auth
token" step above. If the process fails the second time, then it can be
treated as a "genuine" authentication failure and the user notified or other
appropriate actions taken.
</ul>
<p>Some AccountManager methods may need to interact with the user to
prompt for credentials, present options, or ask the user to add an account.
The caller may choose whether to allow AccountManager to directly launch the
necessary user interface and wait for the user, or to return an Intent which
the caller may use to launch the interface, or (in some cases) to install a
notification which the user can select at any time to launch the interface.
To have AccountManager launch the interface directly, the caller must supply
the current foreground {@link Activity} context.
<p>Many AccountManager methods take {@link android.accounts.AccountManagerCallback} and
{@link Handler} as parameters. These methods return immediately and
run asynchronously. If a callback is provided then
{@link android.accounts.AccountManagerCallback#run} will be invoked on the Handler's
thread when the request completes, successfully or not.
The result is retrieved by calling {@link android.accounts.AccountManagerFuture#getResult()}
on the {@link android.accounts.AccountManagerFuture} returned by the method (and also passed
to the callback). This method waits for the operation to complete (if
necessary) and either returns the result or throws an exception if an error
occurred during the operation. To make the request synchronously, call
{@link android.accounts.AccountManagerFuture#getResult()} immediately on receiving the
future from the method; no callback need be supplied.
<p>Requests which may block, including
{@link android.accounts.AccountManagerFuture#getResult()}, must never be called on
the application's main event thread. These operations throw
{@link IllegalStateException} if they are used on the main thread.
*/
var AccountManager = {
/***/
ERROR_CODE_REMOTE_EXCEPTION : "1",
/***/
ERROR_CODE_NETWORK_ERROR : "3",
/***/
ERROR_CODE_CANCELED : "4",
/***/
ERROR_CODE_INVALID_RESPONSE : "5",
/***/
ERROR_CODE_UNSUPPORTED_OPERATION : "6",
/***/
ERROR_CODE_BAD_ARGUMENTS : "7",
/***/
ERROR_CODE_BAD_REQUEST : "8",
/***/
ERROR_CODE_BAD_AUTHENTICATION : "9",
/**@hide */
ERROR_CODE_USER_RESTRICTED : "100",
/**@hide */
ERROR_CODE_MANAGEMENT_DISABLED_FOR_ACCOUNT_TYPE : "101",
/** Bundle key used for the {@link String} account name in results
from methods which return information about a particular account.
*/
KEY_ACCOUNT_NAME : "authAccount",
/** Bundle key used for the {@link String} account type in results
from methods which return information about a particular account.
*/
KEY_ACCOUNT_TYPE : "accountType",
/** Bundle key used for the auth token value in results
from {@link #getAuthToken} and friends.
*/
KEY_AUTHTOKEN : "authtoken",
/** Bundle key used for an {@link Intent} in results from methods that
may require the caller to interact with the user. The Intent can
be used to start the corresponding user interface activity.
*/
KEY_INTENT : "intent",
/** Bundle key used to supply the password directly in options to
{@link #confirmCredentials}, rather than prompting the user with
the standard password prompt.
*/
KEY_PASSWORD : "password",
/***/
KEY_ACCOUNTS : "accounts",
/***/
KEY_ACCOUNT_AUTHENTICATOR_RESPONSE : "accountAuthenticatorResponse",
/***/
KEY_ACCOUNT_MANAGER_RESPONSE : "accountManagerResponse",
/***/
KEY_AUTHENTICATOR_TYPES : "authenticator_types",
/***/
KEY_AUTH_FAILED_MESSAGE : "authFailedMessage",
/***/
KEY_AUTH_TOKEN_LABEL : "authTokenLabelKey",
/***/
KEY_BOOLEAN_RESULT : "booleanResult",
/***/
KEY_ERROR_CODE : "errorCode",
/***/
KEY_ERROR_MESSAGE : "errorMessage",
/***/
KEY_USERDATA : "userdata",
/** Bundle key used to supply the last time the credentials of the account
were authenticated successfully. Time is specified in milliseconds since
epoch. Associated time is updated on successful authentication of account
on adding account, confirming credentials, or updating credentials.
*/
KEY_LAST_AUTHENTICATED_TIME : "lastAuthenticatedTime",
/** Authenticators using 'customTokens' option will also get the UID of the
caller
*/
KEY_CALLER_UID : "callerUid",
/***/
KEY_CALLER_PID : "callerPid",
/** The Android package of the caller will be set in the options bundle by the
{@link android.accounts.AccountManager} and will be passed to the AccountManagerService and
to the AccountAuthenticators. The uid of the caller will be known by the
AccountManagerService as well as the AccountAuthenticators so they will be able to
verify that the package is consistent with the uid (a uid might be shared by many
packages).
*/
KEY_ANDROID_PACKAGE_NAME : "androidPackageName",
/** Boolean, if set and 'customTokens' the authenticator is responsible for
notifications.
@hide
*/
KEY_NOTIFY_ON_FAILURE : "notifyOnAuthFailure",
/***/
ACTION_AUTHENTICATOR_INTENT : "android.accounts.AccountAuthenticator",
/***/
AUTHENTICATOR_META_DATA_NAME : "android.accounts.AccountAuthenticator",
/***/
AUTHENTICATOR_ATTRIBUTES_NAME : "account-authenticator",
/** Action sent as a broadcast Intent by the AccountsService
when accounts are added, accounts are removed, or an
account's credentials (saved password, etc) are changed.
@see #addOnAccountsUpdatedListener
*/
LOGIN_ACCOUNTS_CHANGED_ACTION : "android.accounts.LOGIN_ACCOUNTS_CHANGED",
/**
@hide for internal use only
*/
sanitizeResult : function( ) {},
/**Gets an AccountManager instance associated with a Context.
The {@link Context} will be used as long as the AccountManager is
active, so make sure to use a {@link Context} whose lifetime is
commensurate with any listeners registered to
{@link #addOnAccountsUpdatedListener} or similar methods.
<p>It is safe to call this method from the main thread.
<p>No permission is required to call this method.
@param {Object {Context}} context The {@link Context} to use when necessary
@return {Object {android.accounts.AccountManager}} An {@link AccountManager} instance
*/
get : function( ) {},
/**Gets the saved password associated with the account.
This is intended for authenticators and related code; applications
should get an auth token instead.
<p>It is safe to call this method from the main thread.
<p>This method requires the caller to have a signature match with the
authenticator that owns the specified account.
<p><b>NOTE:</b> If targeting your app to work on API level 22 and before,
AUTHENTICATE_ACCOUNTS permission is needed for those platforms. See docs for
this function in API level 22.
@param {Object {Account}} account The account to query for a password. Must not be {@code null}.
@return {String} The account's password, null if none or if the account doesn't exist
*/
getPassword : function( ) {},
/**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.
<p>It is safe to call this method from the main thread.
<p>This method requires the caller to have a signature match with the
authenticator that owns the specified account.
<p><b>NOTE:</b> If targeting your app to work on API level 22 and before,
AUTHENTICATE_ACCOUNTS permission is needed for those platforms. See docs
for this function in API level 22.
@param {Object {Account}} account The account to query for user data
@return {String} The user data, null if the account or key doesn't exist
*/
getUserData : function( ) {},
/**Lists the currently registered authenticators.
<p>It is safe to call this method from the main thread.
<p>No permission is required to call this method.
@return {Object {android.accounts.AuthenticatorDescription}} An array of {@link AuthenticatorDescription} for every
authenticator known to the AccountManager service. Empty (never
null) if no authenticators are known.
*/
getAuthenticatorTypes : function( ) {},
/**
@hide Lists the currently registered authenticators for a given user id.
<p>It is safe to call this method from the main thread.
<p>The caller has to be in the same user or have the permission
{@link android.Manifest.permission#INTERACT_ACROSS_USERS_FULL}.
@return {Object {android.accounts.AuthenticatorDescription}} An array of {@link AuthenticatorDescription} for every
authenticator known to the AccountManager service. Empty (never
null) if no authenticators are known.
*/
getAuthenticatorTypesAsUser : function( ) {},
/**Lists all accounts of any type registered on the device.
Equivalent to getAccountsByType(null).
<p>It is safe to call this method from the main thread.
<p>Clients of this method that have not been granted the
{@link android.Manifest.permission#GET_ACCOUNTS} permission,
will only see those accounts managed by AbstractAccountAuthenticators whose
signature matches the client.
@return {Object {android.accounts.Account}} An array of {@link Account}, one for each account. Empty
(never null) if no accounts have been added.
*/
getAccounts : function( ) {},
/**
@hide Lists all accounts of any type registered on the device for a given
user id. Equivalent to getAccountsByType(null).
<p>It is safe to call this method from the main thread.
<p>Clients of this method that have not been granted the
{@link android.Manifest.permission#GET_ACCOUNTS} permission,
will only see those accounts managed by AbstractAccountAuthenticators whose
signature matches the client.
@return {Object {android.accounts.Account}} An array of {@link Account}, one for each account. Empty
(never null) if no accounts have been added.
*/
getAccountsAsUser : function( ) {},
/**
@param {String} packageName package name of the calling app.
@param {Number} uid the uid of the calling app.
@param uid the uid of the calling app.
@return {Object {android.accounts.Account}} the accounts that are available to this package and user.
*/
getAccountsForPackage : function( ) {},
/**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.
@param {String} type The type of accounts to return, null to retrieve all accounts
@param {String} packageName The package name of the app for which the accounts are to be returned
@return {Object {android.accounts.Account}} An array of {@link Account}, one per matching account. Empty
(never null) if no accounts of the specified type have been added.
*/
getAccountsByTypeForPackage : function( ) {},
/**Lists all accounts of a particular type. The account type is a
string token corresponding to the authenticator and useful domain
of the account. For example, there are types corresponding to Google
and Facebook. The exact string token to use will be published somewhere
associated with the authenticator in question.
<p>It is safe to call this method from the main thread.
<p>Clients of this method that have not been granted the
{@link android.Manifest.permission#GET_ACCOUNTS} permission,
will only see those accounts managed by AbstractAccountAuthenticators whose
signature matches the client.
<p><b>NOTE:</b> If targeting your app to work on API level 22 and before,
GET_ACCOUNTS permission is needed for those platforms, irrespective of uid
or signature match. See docs for this function in API level 22.
@param {String} type The type of accounts to return, null to retrieve all accounts
@return {Object {android.accounts.Account}} An array of {@link Account}, one per matching account. Empty
(never null) if no accounts of the specified type have been added.
*/
getAccountsByType : function( ) {},
/**
@hide Same as {@link #getAccountsByType(String)} but for a specific user.
*/
getAccountsByTypeAsUser : function( ) {},
/**Change whether or not an app (identified by its uid) is allowed to retrieve an authToken
for an account.
<p>
This is only meant to be used by system activities and is not in the SDK.
@param {Object {Account}} account The account whose permissions are being modified
@param {String} authTokenType The type of token whose permissions are being modified
@param {Number} uid The uid that identifies the app which is being granted or revoked permission.
@param {Boolean} value true is permission is being granted, false for revoked
@hide
*/
updateAppPermission : function( ) {},
/**Get the user-friendly label associated with an authenticator's auth token.
@param {String} accountType the type of the authenticator. must not be null.
@param {String} authTokenType the token type. must not be null.
@param {Object {android.accounts.AccountManagerCallback}} callback callback to invoke when the result is available. may be null.
@param {Object {Handler}} handler the handler on which to invoke the callback, or null for the main thread
@return {Object {android.accounts.AccountManagerFuture}} a future containing the label string
@hide
*/
getAuthTokenLabel : function( ) {},
/**Finds out whether a particular account has all the specified features.
Account features are authenticator-specific string tokens identifying
boolean account properties. For example, features are used to tell
whether Google accounts have a particular service (such as Google
Calendar or Google Talk) enabled. The feature names and their meanings
are published somewhere associated with the authenticator in question.
<p>This method may be called from any thread, but the returned
{@link android.accounts.AccountManagerFuture} must not be used on the main thread.
<p>This method requires the caller to hold the permission
{@link android.Manifest.permission#GET_ACCOUNTS} or be a signature
match with the AbstractAccountAuthenticator that manages the account.
@param {Object {Account}} account The {@link Account} to test
@param {Object {java.lang.String[]}} features An array of the account features to check
@param {Object {android.accounts.AccountManagerCallback}} callback Callback to invoke when the request completes,
null for no callback
@param {Object {Handler}} handler {@link Handler} identifying the callback thread,
null for the main thread
@return {Object {android.accounts.AccountManagerFuture}} An {@link AccountManagerFuture} which resolves to a Boolean,
true if the account exists and has all of the specified features.
*/
hasFeatures : function( ) {},
/**Lists all accounts of a type which have certain features. The account
type identifies the authenticator (see {@link #getAccountsByType}).
Account features are authenticator-specific string tokens identifying
boolean account properties (see {@link #hasFeatures}).
<p>Unlike {@link #getAccountsByType}, this method calls the authenticator,
which may contact the server or do other work to check account features,
so the method returns an {@link android.accounts.AccountManagerFuture}.
<p>This method may be called from any thread, but the returned
{@link android.accounts.AccountManagerFuture} must not be used on the main thread.
<p>Clients of this method that have not been granted the
{@link android.Manifest.permission#GET_ACCOUNTS} permission,
will only see those accounts managed by AbstractAccountAuthenticators whose
signature matches the client.
@param {String} type The type of accounts to return, must not be null
@param {Object {java.lang.String[]}} features An array of the account features to require,
may be null or empty
<p><b>NOTE:</b> If targeting your app to work on API level 22 and before,
GET_ACCOUNTS permission is needed for those platforms, irrespective of uid
or signature match. See docs for this function in API level 22.
@param {Object {android.accounts.AccountManagerCallback}} callback Callback to invoke when the request completes,
null for no callback
@param {Object {Handler}} handler {@link Handler} identifying the callback thread,
null for the main thread
@return {Object {android.accounts.AccountManagerFuture}} An {@link AccountManagerFuture} which resolves to an array of
{@link Account}, one per account of the specified type which
matches the requested features.
*/
getAccountsByTypeAndFeatures : function( ) {},
/**Adds an account directly to the AccountManager. Normally used by sign-up
wizards associated with authenticators, not directly by applications.
<p>Calling this method does not update the last authenticated timestamp,
referred by {@link #KEY_LAST_AUTHENTICATED_TIME}. To update it, call
{@link #notifyAccountAuthenticated}(Account) after getting success.
However, if this method is called when it is triggered by addAccount() or
addAccountAsUser() or similar functions, then there is no need to update
timestamp manually as it is updated automatically by framework on
successful completion of the mentioned functions.
<p>It is safe to call this method from the main thread.
<p>This method requires the caller to have a signature match with the
authenticator that owns the specified account.
<p><b>NOTE:</b> If targeting your app to work on API level 22 and before,
AUTHENTICATE_ACCOUNTS permission is needed for those platforms. See docs
for this function in API level 22.
@param {Object {Account}} account The {@link Account} to add
@param {String} password The password to associate with the account, null for none
@param {Object {Bundle}} userdata String values to use for the account's userdata, null for
none
@return {Boolean} True if the account was successfully added, false if the account
already exists, the account is null, or another error occurs.
*/
addAccountExplicitly : function( ) {},
/**Notifies the system that the account has just been authenticated. This
information may be used by other applications to verify the account. This
should be called only when the user has entered correct credentials for
the account.
<p>
It is not safe to call this method from the main thread. As such, call it
from another thread.
<p>This method requires the caller to have a signature match with the
authenticator that owns the specified account.
@param {Object {Account}} account The {@link Account} to be updated.
@return {Boolean} boolean {@code true} if the authentication of the account has been successfully
acknowledged. Otherwise {@code false}.
*/
notifyAccountAuthenticated : function( ) {},
/**Rename the specified {@link android.accounts.Account}. This is equivalent to removing
the existing account and adding a new renamed account with the old
account's user data.
<p>It is safe to call this method from the main thread.
<p>This method requires the caller to have a signature match with the
authenticator that manages the specified account.
<p><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.
@param {Object {Account}} account The {@link Account} to rename
@param {String} newName String name to be associated with the account.
@param {Object {android.accounts.AccountManagerCallback}} callback Callback to invoke when the request completes, null for
no callback
@param {Object {Handler}} handler {@link Handler} identifying the callback thread, null for
the main thread
@return {Object {android.accounts.AccountManagerFuture}} An {@link AccountManagerFuture} which resolves to the Account
after the name change. If successful the account's name will be the
specified new name.
*/
renameAccount : function( ) {},
/**Gets the previous name associated with the account or {@code null}, if
none. This is intended so that clients of {@link #LOGIN_ACCOUNTS_CHANGED_ACTION} broadcasts can determine if an
authenticator has renamed an account.
<p>It is safe to call this method from the main thread.
@param {Object {Account}} account The account to query for a previous name.
@return {String} The account's previous name, null if the account has never been
renamed.
*/
getPreviousName : function( ) {},
/**Removes an account from the AccountManager. Does nothing if the account
does not exist. Does not delete the account from the server.
The authenticator may have its own policies preventing account
deletion, in which case the account will not be deleted.
<p>This method requires the caller to have a signature match with the
authenticator that manages the specified account.
<p><b>NOTE:</b> If targeting your app to work on API level 22 and before,
MANAGE_ACCOUNTS permission is needed for those platforms. See docs for
this function in API level 22.
@param {Object {Account}} account The {@link Account} to remove
@param {Object {android.accounts.AccountManagerCallback}} callback Callback to invoke when the request completes,
null for no callback
@param {Object {Handler}} handler {@link Handler} identifying the callback thread,
null for the main thread
@return {Object {android.accounts.AccountManagerFuture}} An {@link AccountManagerFuture} which resolves to a Boolean,
true if the account has been successfully removed
@deprecated use
{@link #removeAccount(Account, Activity, AccountManagerCallback, Handler)}
instead
*/
removeAccount : function( ) {},
/**Removes an account from the AccountManager. Does nothing if the account
does not exist. Does not delete the account from the server.
The authenticator may have its own policies preventing account
deletion, in which case the account will not be deleted.
<p>This method may be called from any thread, but the returned
{@link android.accounts.AccountManagerFuture} must not be used on the main thread.
<p>This method requires the caller to have a signature match with the
authenticator that manages the specified account.
<p><b>NOTE:</b> If targeting your app to work on API level 22 and before,
MANAGE_ACCOUNTS permission is needed for those platforms. See docs for
this function in API level 22.
@param {Object {Account}} account The {@link Account} to remove
@param {Object {Activity}} activity The {@link Activity} context to use for launching a new
authenticator-defined sub-Activity to prompt the user to delete an
account; used only to call startActivity(); if null, the prompt
will not be launched directly, but the {@link Intent} may be
returned to the caller instead
@param {Object {android.accounts.AccountManagerCallback}} callback Callback to invoke when the request completes,
null for no callback
@param {Object {Handler}} handler {@link Handler} identifying the callback thread,
null for the main thread
@return {Object {android.accounts.AccountManagerFuture}} An {@link AccountManagerFuture} which resolves to a Bundle with
{@link #KEY_BOOLEAN_RESULT} if activity was specified and an account
was removed or if active. If no activity was specified, the returned
Bundle contains only {@link #KEY_INTENT} with the {@link Intent}
needed to launch the actual account removal process, if authenticator
needs the activity launch. If an error occurred,
{@link AccountManagerFuture#getResult()} throws:
<ul>
<li> {@link AuthenticatorException} if no authenticator was registered for
this account type or the authenticator failed to respond
<li> {@link OperationCanceledException} if the operation was canceled for
any reason, including the user canceling the creation process or
adding accounts (of this type) has been disabled by policy
</ul>
*/
removeAccount : function( ) {},
/**
@see #removeAccount(Account, AccountManagerCallback, Handler)
@hide
@deprecated use
{@link #removeAccountAsUser(Account, Activity, AccountManagerCallback, Handler)}
instead
*/
removeAccountAsUser : function( ) {},
/**
@see #removeAccount(Account, Activity, AccountManagerCallback, Handler)
@hide
*/
removeAccountAsUser : function( ) {},
/**Removes an account directly. Normally used by authenticators, not
directly by applications. Does not delete the account from the server.
The authenticator may have its own policies preventing account deletion,
in which case the account will not be deleted.
<p>
It is safe to call this method from the main thread.
<p>This method requires the caller to have a signature match with the
authenticator that manages the specified account.
<p><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.
@param {Object {Account}} account The {@link Account} to delete.
@return {Boolean} True if the account was successfully deleted, false if the
account did not exist, the account is null, or another error
occurs.
*/
removeAccountExplicitly : function( ) {},
/**Removes an auth token from the AccountManager's cache. Does nothing if
the auth token is not currently in the cache. Applications must call this
method when the auth token is found to have expired or otherwise become
invalid for authenticating requests. The AccountManager does not validate
or expire cached auth tokens otherwise.
<p>It is safe to call this method from the main thread.
<p><b>NOTE:</b> If targeting your app to work on API level 22 and before,
MANAGE_ACCOUNTS or USE_CREDENTIALS permission is needed for those
platforms. See docs for this function in API level 22.
@param {String} accountType The account type of the auth token to invalidate, must not be null
@param {String} authToken The auth token to invalidate, may be null
*/
invalidateAuthToken : function( ) {},
/**Gets an auth token from the AccountManager's cache. If no auth
token is cached for this account, null will be returned -- a new
auth token will not be generated, and the server will not be contacted.
Intended for use by the authenticator, not directly by applications.
<p>It is safe to call this method from the main thread.
<p>This method requires the caller to have a signature match with the
authenticator that manages the specified account.
<p><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.
@param {Object {Account}} account The account for which an auth token is to be fetched. Cannot be {@code null}.
@param {String} authTokenType The type of auth token to fetch. Cannot be {@code null}.
@return {String} The cached auth token for this account and type, or null if
no auth token is cached or the account does not exist.
@see #getAuthToken
*/
peekAuthToken : function( ) {},
/**Sets or forgets a saved password. This modifies the local copy of the
password used to automatically authenticate the user; it does not change
the user's account password on the server. Intended for use by the
authenticator, not directly by applications.
<p>Calling this method does not update the last authenticated timestamp,
referred by {@link #KEY_LAST_AUTHENTICATED_TIME}. To update it, call
{@link #notifyAccountAuthenticated}(Account) after getting success.
<p>It is safe to call this method from the main thread.
<p>This method requires the caller to have a signature match with the
authenticator that manages the specified account.
<p><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.
@param {Object {Account}} account The account whose password is to be set. Cannot be
{@code null}.
@param {String} password The password to set, null to clear the password
*/
setPassword : function( ) {},
/**Forgets a saved password. This erases the local copy of the password;
it does not change the user's account password on the server.
Has the same effect as setPassword(account, null) but requires fewer
permissions, and may be used by applications or management interfaces
to "sign out" from an account.
<p>This method only successfully clear the account's password when the
caller has the same signature as the authenticator that owns the
specified account. Otherwise, this method will silently fail.
<p>It is safe to call this method from the main thread.
<p><b>NOTE:</b> If targeting your app to work on API level 22 and before,
MANAGE_ACCOUNTS permission is needed for those platforms. See docs for
this function in API level 22.
@param {Object {Account}} account The account whose password to clear
*/
clearPassword : function( ) {},
/**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.
<p>It is safe to call this method from the main thread.
<p>This method requires the caller to have a signature match with the
authenticator that manages the specified account.
<p><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.
@param {Object {Account}} account Account whose user data is to be set. Must not be {@code null}.
@param {String} key String user data key to set. Must not be null
@param {String} value String value to set, {@code null} to clear this user data key
*/
setUserData : function( ) {},
/**Adds an auth token to the AccountManager cache for an account.
If the account does not exist then this call has no effect.
Replaces any previous auth token for this account and auth token type.
Intended for use by the authenticator, not directly by applications.
<p>It is safe to call this method from the main thread.
<p>This method requires the caller to have a signature match with the
authenticator that manages the specified account.
<p><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.
@param {Object {Account}} account The account to set an auth token for
@param {String} authTokenType The type of the auth token, see {#getAuthToken}
@param {String} authToken The auth token to add to the cache
*/
setAuthToken : function( ) {},
/**This convenience helper synchronously gets an auth token with
{@link #getAuthToken(android.accounts.Account, String, boolean, android.accounts.AccountManagerCallback, Handler)}.
<p>This method may block while a network request completes, and must
never be made from the main thread.
<p><b>NOTE:</b> If targeting your app to work on API level 22 and before,
USE_CREDENTIALS permission is needed for those platforms. See docs for
this function in API level 22.
@param {Object {Account}} account The account to fetch an auth token for
@param {String} authTokenType The auth token type, see {@link #getAuthToken getAuthToken()}
@param {Boolean} notifyAuthFailure If true, display a notification and return null
if authentication fails; if false, prompt and wait for the user to
re-enter correct credentials before returning
@return {String} An auth token of the specified type for this account, or null
if authentication fails or none can be fetched.
@throws AuthenticatorException if the authenticator failed to respond
@throws OperationCanceledException if the request was canceled for any
reason, including the user canceling a credential request
@throws java.io.IOException if the authenticator experienced an I/O problem
creating a new auth token, usually because of network trouble
*/
blockingGetAuthToken : function( ) {},
/**Gets an auth token of the specified type for a particular account,
prompting the user for credentials if necessary. This method is
intended for applications running in the foreground where it makes
sense to ask the user directly for a password.
<p>If a previously generated auth token is cached for this account and
type, then it is returned. Otherwise, if a saved password is
available, it is sent to the server to generate a new auth token.
Otherwise, the user is prompted to enter a password.
<p>Some authenticators have auth token <em>types</em>, whose value
is authenticator-dependent. Some services use different token types to
access different functionality -- for example, Google uses different auth
tokens to access Gmail and Google Calendar for the same account.
<p><b>NOTE:</b> If targeting your app to work on API level 22 and before,
USE_CREDENTIALS permission is needed for those platforms. See docs for
this function in API level 22.
<p>This method may be called from any thread, but the returned
{@link android.accounts.AccountManagerFuture} must not be used on the main thread.
@param {Object {Account}} account The account to fetch an auth token for
@param {String} authTokenType The auth token type, an authenticator-dependent
string token, must not be null
@param {Object {Bundle}} options Authenticator-specific options for the request,
may be null or empty
@param {Object {Activity}} activity The {@link Activity} context to use for launching a new
authenticator-defined sub-Activity to prompt the user for a password
if necessary; used only to call startActivity(); must not be null.
@param {Object {android.accounts.AccountManagerCallback}} callback Callback to invoke when the request completes,
null for no callback
@param {Object {Handler}} handler {@link Handler} identifying the callback thread,
null for the main thread
@return {Object {android.accounts.AccountManagerFuture}} An {@link AccountManagerFuture} which resolves to a Bundle with
at least the following fields:
<ul>
<li> {@link #KEY_ACCOUNT_NAME} - the name of the account you supplied
<li> {@link #KEY_ACCOUNT_TYPE} - the type of the account
<li> {@link #KEY_AUTHTOKEN} - the auth token you wanted
</ul>
(Other authenticator-specific values may be returned.) If an auth token
could not be fetched, {@link AccountManagerFuture#getResult()} throws:
<ul>
<li> {@link AuthenticatorException} if the authenticator failed to respond
<li> {@link OperationCanceledException} if the operation is canceled for
any reason, incluidng the user canceling a credential request
<li> {@link IOException} if the authenticator experienced an I/O problem
creating a new auth token, usually because of network trouble
</ul>
If the account is no longer present on the device, the return value is
authenticator-dependent. The caller should verify the validity of the
account before requesting an auth token.
*/
getAuthToken : function( ) {},
/**Gets an auth token of the specified type for a particular account,
optionally raising a notification if the user must enter credentials.
This method is intended for background tasks and services where the
user should not be immediately interrupted with a password prompt.
<p>If a previously generated auth token is cached for this account and
type, then it is returned. Otherwise, if a saved password is
available, it is sent to the server to generate a new auth token.
Otherwise, an {@link Intent} is returned which, when started, will
prompt the user for a password. If the notifyAuthFailure parameter is
set, a status bar notification is also created with the same Intent,
alerting the user that they need to enter a password at some point.
<p>In that case, you may need to wait until the user responds, which
could take hours or days or forever. When the user does respond and
supply a new password, the account manager will broadcast the
{@link #LOGIN_ACCOUNTS_CHANGED_ACTION} Intent, which applications can
use to try again.
<p>If notifyAuthFailure is not set, it is the application's
responsibility to launch the returned Intent at some point.
Either way, the result from this call will not wait for user action.
<p>Some authenticators have auth token <em>types</em>, whose value
is authenticator-dependent. Some services use different token types to
access different functionality -- for example, Google uses different auth
tokens to access Gmail and Google Calendar for the same account.
<p>This method may be called from any thread, but the returned
{@link android.accounts.AccountManagerFuture} must not be used on the main thread.
@param {Object {Account}} account The account to fetch an auth token for
@param {String} authTokenType The auth token type, an authenticator-dependent
string token, must not be null
@param {Boolean} notifyAuthFailure True to add a notification to prompt the
user for a password if necessary, false to leave that to the caller
@param {Object {android.accounts.AccountManagerCallback}} callback Callback to invoke when the request completes,
null for no callback
@param {Object {Handler}} handler {@link Handler} identifying the callback thread,
null for the main thread
@return {Object {android.accounts.AccountManagerFuture}} An {@link AccountManagerFuture} which resolves to a Bundle with
at least the following fields on success:
<ul>
<li> {@link #KEY_ACCOUNT_NAME} - the name of the account you supplied
<li> {@link #KEY_ACCOUNT_TYPE} - the type of the account
<li> {@link #KEY_AUTHTOKEN} - the auth token you wanted
</ul>
(Other authenticator-specific values may be returned.) If the user
must enter credentials, the returned Bundle contains only
{@link #KEY_INTENT} with the {@link Intent} needed to launch a prompt.
If an error occurred, {@link AccountManagerFuture#getResult()} throws:
<ul>
<li> {@link AuthenticatorException} if the authenticator failed to respond
<li> {@link OperationCanceledException} if the operation is canceled for
any reason, incluidng the user canceling a credential request
<li> {@link IOException} if the authenticator experienced an I/O problem
creating a new auth token, usually because of network trouble
</ul>
If the account is no longer present on the device, the return value is
authenticator-dependent. The caller should verify the validity of the
account before requesting an auth token.
@deprecated use {@link #getAuthToken(Account, String, android.os.Bundle,
boolean, AccountManagerCallback, android.os.Handler)} instead
*/
getAuthToken : function( ) {},
/**Gets an auth token of the specified type for a particular account,
optionally raising a notification if the user must enter credentials.
This method is intended for background tasks and services where the
user should not be immediately interrupted with a password prompt.
<p>If a previously generated auth token is cached for this account and
type, then it is returned. Otherwise, if a saved password is
available, it is sent to the server to generate a new auth token.
Otherwise, an {@link Intent} is returned which, when started, will
prompt the user for a password. If the notifyAuthFailure parameter is
set, a status bar notification is also created with the same Intent,
alerting the user that they need to enter a password at some point.
<p>In that case, you may need to wait until the user responds, which
could take hours or days or forever. When the user does respond and
supply a new password, the account manager will broadcast the
{@link #LOGIN_ACCOUNTS_CHANGED_ACTION} Intent, which applications can
use to try again.
<p>If notifyAuthFailure is not set, it is the application's
responsibility to launch the returned Intent at some point.
Either way, the result from this call will not wait for user action.
<p>Some authenticators have auth token <em>types</em>, whose value
is authenticator-dependent. Some services use different token types to
access different functionality -- for example, Google uses different auth
tokens to access Gmail and Google Calendar for the same account.
<p>This method may be called from any thread, but the returned
{@link android.accounts.AccountManagerFuture} must not be used on the main thread.
<p><b>NOTE:</b> If targeting your app to work on API level 22 and before,
USE_CREDENTIALS permission is needed for those platforms. See docs for
this function in API level 22.
@param {Object {Account}} account The account to fetch an auth token for
@param {String} authTokenType The auth token type, an authenticator-dependent
string token, must not be null
@param {Object {Bundle}} options Authenticator-specific options for the request,
may be null or empty
@param {Boolean} notifyAuthFailure True to add a notification to prompt the
user for a password if necessary, false to leave that to the caller
@param {Object {android.accounts.AccountManagerCallback}} callback Callback to invoke when the request completes,
null for no callback
@param {Object {Handler}} handler {@link Handler} identifying the callback thread,
null for the main thread
@return {Object {android.accounts.AccountManagerFuture}} An {@link AccountManagerFuture} which resolves to a Bundle with
at least the following fields on success:
<ul>
<li> {@link #KEY_ACCOUNT_NAME} - the name of the account you supplied
<li> {@link #KEY_ACCOUNT_TYPE} - the type of the account
<li> {@link #KEY_AUTHTOKEN} - the auth token you wanted
</ul>
(Other authenticator-specific values may be returned.) If the user
must enter credentials, the returned Bundle contains only
{@link #KEY_INTENT} with the {@link Intent} needed to launch a prompt.
If an error occurred, {@link AccountManagerFuture#getResult()} throws:
<ul>
<li> {@link AuthenticatorException} if the authenticator failed to respond
<li> {@link OperationCanceledException} if the operation is canceled for
any reason, incluidng the user canceling a credential request
<li> {@link IOException} if the authenticator experienced an I/O problem
creating a new auth token, usually because of network trouble
</ul>
If the account is no longer present on the device, the return value is
authenticator-dependent. The caller should verify the validity of the
account before requesting an auth token.
*/
getAuthToken : function( ) {},
/**Asks the user to add an account of a specified type. The authenticator
for this account type processes this request with the appropriate user
interface. If the user does elect to create a new account, the account
name is returned.
<p>This method may be called from any thread, but the returned
{@link android.accounts.AccountManagerFuture} must not be used on the main thread.
<p><b>NOTE:</b> If targeting your app to work on API level 22 and before,
MANAGE_ACCOUNTS permission is needed for those platforms. See docs for
this function in API level 22.
@param {String} accountType The type of account to add; must not be null
@param {String} authTokenType The type of auth token (see {@link #getAuthToken})
this account will need to be able to generate, null for none
@param {Object {java.lang.String[]}} requiredFeatures The features (see {@link #hasFeatures}) this
account must have, null for none
@param {Object {Bundle}} addAccountOptions Authenticator-specific options for the request,
may be null or empty
@param {Object {Activity}} activity The {@link Activity} context to use for launching a new
authenticator-defined sub-Activity to prompt the user to create an
account; used only to call startActivity(); if null, the prompt
will not be launched directly, but the necessary {@link Intent}
will be returned to the caller instead
@param {Object {android.accounts.AccountManagerCallback}} callback Callback to invoke when the request completes,
null for no callback
@param {Object {Handler}} handler {@link Handler} identifying the callback thread,
null for the main thread
@return {Object {android.accounts.AccountManagerFuture}} An {@link AccountManagerFuture} which resolves to a Bundle with
these fields if activity was specified and an account was created:
<ul>
<li> {@link #KEY_ACCOUNT_NAME} - the name of the account created
<li> {@link #KEY_ACCOUNT_TYPE} - the type of the account
</ul>
If no activity was specified, the returned Bundle contains only
{@link #KEY_INTENT} with the {@link Intent} needed to launch the
actual account creation process. If an error occurred,
{@link AccountManagerFuture#getResult()} throws:
<ul>
<li> {@link AuthenticatorException} if no authenticator was registered for
this account type or the authenticator failed to respond
<li> {@link OperationCanceledException} if the operation was canceled for
any reason, including the user canceling the creation process or adding accounts
(of this type) has been disabled by policy
<li> {@link IOException} if the authenticator experienced an I/O problem
creating a new account, usually because of network trouble
</ul>
*/
addAccount : function( ) {},
/**
@see #addAccount(String, String, String[], Bundle, Activity, AccountManagerCallback, Handler)
@hide
*/
addAccountAsUser : function( ) {},
/**Adds a shared account from the primary user to a secondary user. Adding the shared account
doesn't take effect immediately. When the target user starts up, any pending shared accounts
are attempted to be copied to the target user from the primary via calls to the
authenticator.
@param {Object {Account}} account the account to share
@param {Object {UserHandle}} user the target user
@return {Boolean}
@hide
*/
addSharedAccount : function( ) {},
/**Copies an account from the primary user to another user.
@param {Object {Account}} account the account to copy
@param {Object {UserHandle}} user the target user
@param {Object {android.accounts.AccountManagerCallback}} callback Callback to invoke when the request completes,
null for no callback
@param {Object {Handler}} handler {@link Handler} identifying the callback thread,
null for the main thread
@return {Object {android.accounts.AccountManagerFuture}} An {@link AccountManagerFuture} which resolves to a Boolean indicated wether it
succeeded.
@hide
*/
copyAccountToUser : function( ) {},
/**
@param {Object {Account}} account the account to remove
@param {Object {UserHandle}} user the user to remove the account from
@param user the user to remove the account from
@return {Boolean}
*/
removeSharedAccount : function( ) {},
/**
@param {Object {UserHandle}} user
@param user
@return {Object {android.accounts.Account}}
*/
getSharedAccounts : function( ) {},
/**Confirms that the user knows the password for an account to make extra
sure they are the owner of the account. The user-entered password can
be supplied directly, otherwise the authenticator for this account type
prompts the user with the appropriate interface. This method is
intended for applications which want extra assurance; for example, the
phone lock screen uses this to let the user unlock the phone with an
account password if they forget the lock pattern.
<p>If the user-entered password matches a saved password for this
account, the request is considered valid; otherwise the authenticator
verifies the password (usually by contacting the server).
<p>This method may be called from any thread, but the returned
{@link android.accounts.AccountManagerFuture} must not be used on the main thread.
<p><b>NOTE:</b> If targeting your app to work on API level 22 and before,
MANAGE_ACCOUNTS permission is needed for those platforms. See docs
for this function in API level 22.
@param {Object {Account}} account The account to confirm password knowledge for
@param {Object {Bundle}} options Authenticator-specific options for the request;
if the {@link #KEY_PASSWORD} string field is present, the
authenticator may use it directly rather than prompting the user;
may be null or empty
@param {Object {Activity}} activity The {@link Activity} context to use for launching a new
authenticator-defined sub-Activity to prompt the user to enter a
password; used only to call startActivity(); if null, the prompt
will not be launched directly, but the necessary {@link Intent}
will be returned to the caller instead
@param {Object {android.accounts.AccountManagerCallback}} callback Callback to invoke when the request completes,
null for no callback
@param {Object {Handler}} handler {@link Handler} identifying the callback thread,
null for the main thread
@return {Object {android.accounts.AccountManagerFuture}} An {@link AccountManagerFuture} which resolves to a Bundle
with these fields if activity or password was supplied and
the account was successfully verified:
<ul>
<li> {@link #KEY_ACCOUNT_NAME} - the name of the account verified
<li> {@link #KEY_ACCOUNT_TYPE} - the type of the account
<li> {@link #KEY_BOOLEAN_RESULT} - true to indicate success
</ul>
If no activity or password was specified, the returned Bundle contains
{@link #KEY_INTENT} with the {@link Intent} needed to launch the
password prompt.
<p>Also the returning Bundle may contain {@link
#KEY_LAST_AUTHENTICATED_TIME} indicating the last time the
credential was validated/created.
If an error occurred,{@link AccountManagerFuture#getResult()} throws:
<ul>
<li> {@link AuthenticatorException} if the authenticator failed to respond
<li> {@link OperationCanceledException} if the operation was canceled for
any reason, including the user canceling the password prompt
<li> {@link IOException} if the authenticator experienced an I/O problem
verifying the password, usually because of network trouble
</ul>
*/
confirmCredentials : function( ) {},
/**
@hide Same as {@link #confirmCredentials(Account, Bundle, Activity, AccountManagerCallback, Handler)}
but for the specified user.
*/
confirmCredentialsAsUser : function( ) {},
/**Asks the user to enter a new password for an account, updating the
saved credentials for the account. Normally this happens automatically
when the server rejects credentials during an auth token fetch, but this
can be invoked directly to ensure we have the correct credentials stored.
<p>This method may be called from any thread, but the returned
{@link android.accounts.AccountManagerFuture} must not be used on the main thread.
<p><b>NOTE:</b> If targeting your app to work on API level 22 and before,
MANAGE_ACCOUNTS permission is needed for those platforms. See docs for
this function in API level 22.
@param {Object {Account}} account The account to update credentials for
@param {String} authTokenType The credentials entered must allow an auth token
of this type to be created (but no actual auth token is returned);
may be null
@param {Object {Bundle}} options Authenticator-specific options for the request;
may be null or empty
@param {Object {Activity}} activity The {@link Activity} context to use for launching a new
authenticator-defined sub-Activity to prompt the user to enter a
password; used only to call startActivity(); if null, the prompt
will not be launched directly, but the necessary {@link Intent}
will be returned to the caller instead
@param {Object {android.accounts.AccountManagerCallback}} callback Callback to invoke when the request completes,
null for no callback
@param {Object {Handler}} handler {@link Handler} identifying the callback thread,
null for the main thread
@return {Object {android.accounts.AccountManagerFuture}} An {@link AccountManagerFuture} which resolves to a Bundle
with these fields if an activity was supplied and the account
credentials were successfully updated:
<ul>
<li> {@link #KEY_ACCOUNT_NAME} - the name of the account
<li> {@link #KEY_ACCOUNT_TYPE} - the type of the account
</ul>
If no activity was specified, the returned Bundle contains
{@link #KEY_INTENT} with the {@link Intent} needed to launch the
password prompt. If an error occurred,
{@link AccountManagerFuture#getResult()} throws:
<ul>
<li> {@link AuthenticatorException} if the authenticator failed to respond
<li> {@link OperationCanceledException} if the operation was canceled for
any reason, including the user canceling the password prompt
<li> {@link IOException} if the authenticator experienced an I/O problem
verifying the password, usually because of network trouble
</ul>
*/
updateCredentials : function( ) {},
/**Offers the user an opportunity to change an authenticator's settings.
These properties are for the authenticator in general, not a particular
account. Not all authenticators support this method.
<p>This method may be called from any thread, but the returned
{@link android.accounts.AccountManagerFuture} must not be used on the main thread.
<p>This method requires the caller to have the same signature as the
authenticator associated with the specified account type.
<p><b>NOTE:</b> If targeting your app to work on API level 22 and before,
MANAGE_ACCOUNTS permission is needed for those platforms. See docs
for this function in API level 22.
@param {String} accountType The account type associated with the authenticator
to adjust
@param {Object {Activity}} activity The {@link Activity} context to use for launching a new
authenticator-defined sub-Activity to adjust authenticator settings;
used only to call startActivity(); if null, the settings dialog will
not be launched directly, but the necessary {@link Intent} will be
returned to the caller instead
@param {Object {android.accounts.AccountManagerCallback}} callback Callback to invoke when the request completes,
null for no callback
@param {Object {Handler}} handler {@link Handler} identifying the callback thread,
null for the main thread
@return {Object {android.accounts.AccountManagerFuture}} An {@link AccountManagerFuture} which resolves to a Bundle
which is empty if properties were edited successfully, or
if no activity was specified, contains only {@link #KEY_INTENT}
needed to launch the authenticator's settings dialog.
If an error occurred, {@link AccountManagerFuture#getResult()}
throws:
<ul>
<li> {@link AuthenticatorException} if no authenticator was registered for
this account type or the authenticator failed to respond
<li> {@link OperationCanceledException} if the operation was canceled for
any reason, including the user canceling the settings dialog
<li> {@link IOException} if the authenticator experienced an I/O problem
updating settings, usually because of network trouble
</ul>
*/
editProperties : function( ) {},
/**This convenience helper combines the functionality of
{@link #getAccountsByTypeAndFeatures}, {@link #getAuthToken}, and
{@link #addAccount}.
<p>This method gets a list of the accounts matching the
specified type and feature set; if there is exactly one, it is
used; if there are more than one, the user is prompted to pick one;
if there are none, the user is prompted to add one. Finally,
an auth token is acquired for the chosen account.
<p>This method may be called from any thread, but the returned
{@link android.accounts.AccountManagerFuture} must not be used on the main thread.
<p><b>NOTE:</b> If targeting your app to work on API level 22 and before,
MANAGE_ACCOUNTS permission is needed for those platforms. See docs for
this function in API level 22.
@param {String} accountType The account type required
(see {@link #getAccountsByType}), must not be null
@param {String} authTokenType The desired auth token type
(see {@link #getAuthToken}), must not be null
@param {Object {java.lang.String[]}} features Required features for the account
(see {@link #getAccountsByTypeAndFeatures}), may be null or empty
@param {Object {Activity}} activity The {@link Activity} context to use for launching new
sub-Activities to prompt to add an account, select an account,
and/or enter a password, as necessary; used only to call
startActivity(); should not be null
@param {Object {Bundle}} addAccountOptions Authenticator-specific options to use for
adding new accounts; may be null or empty
@param {Object {Bundle}} getAuthTokenOptions Authenticator-specific options to use for
getting auth tokens; may be null or empty
@param {Object {android.accounts.AccountManagerCallback}} callback Callback to invoke when the request completes,
null for no callback
@param {Object {Handler}} handler {@link Handler} identifying the callback thread,
null for the main thread
@return {Object {android.accounts.AccountManagerFuture}} An {@link AccountManagerFuture} which resolves to a Bundle with
at least the following fields:
<ul>
<li> {@link #KEY_ACCOUNT_NAME} - the name of the account
<li> {@link #KEY_ACCOUNT_TYPE} - the type of the account
<li> {@link #KEY_AUTHTOKEN} - the auth token you wanted
</ul>
If an error occurred, {@link AccountManagerFuture#getResult()} throws:
<ul>
<li> {@link AuthenticatorException} if no authenticator was registered for
this account type or the authenticator failed to respond
<li> {@link OperationCanceledException} if the operation was canceled for
any reason, including the user canceling any operation
<li> {@link IOException} if the authenticator experienced an I/O problem
updating settings, usually because of network trouble
</ul>
*/
getAuthTokenByFeatures : function( ) {},
/**Deprecated in favor of {@link #newChooseAccountIntent(Account, List, String[], String,
String, String[], Bundle)}.
Returns an intent to an {@link Activity} that prompts the user to choose from a list of
accounts.
The caller will then typically start the activity by calling
<code>startActivityForResult(intent, ...);</code>.
<p>
On success the activity returns a Bundle with the account name and type specified using
keys {@link #KEY_ACCOUNT_NAME} and {@link #KEY_ACCOUNT_TYPE}.
<p>
The most common case is to call this with one account type, e.g.:
<p>
<pre> newChooseAccountIntent(null, null, new String[]{"com.google"}, false, null,
null, null, null);</pre>
@param {Object {Account}} selectedAccount if specified, indicates that the {@link Account} is the currently
selected one, according to the caller's definition of selected.
@param {Object {java.util.ArrayList}} allowableAccounts an optional {@link List} of accounts that are allowed to be
shown. If not specified then this field will not limit the displayed accounts.
@param {Object {java.lang.String[]}} allowableAccountTypes an optional string array of account types. These are used
both to filter the shown accounts and to filter the list of account types that are shown
when adding an account. If not specified then this field will not limit the displayed
account types when adding an account.
@param {Boolean} alwaysPromptForAccount boolean that is ignored.
@param {String} descriptionOverrideText if non-null this string is used as the description in the
accounts chooser screen rather than the default
@param {String} addAccountAuthTokenType this string is passed as the {@link #addAccount}
authTokenType parameter
@param {Object {java.lang.String[]}} addAccountRequiredFeatures this string array is passed as the {@link #addAccount}
requiredFeatures parameter
@param {Object {Bundle}} addAccountOptions This {@link Bundle} is passed as the {@link #addAccount} options
parameter
@return {Object {android.content.Intent}} an {@link Intent} that can be used to launch the ChooseAccount activity flow.
*/
newChooseAccountIntent : function( ) {},
/**Returns an intent to an {@link Activity} that prompts the user to choose from a list of
accounts.
The caller will then typically start the activity by calling
<code>startActivityForResult(intent, ...);</code>.
<p>
On success the activity returns a Bundle with the account name and type specified using
keys {@link #KEY_ACCOUNT_NAME} and {@link #KEY_ACCOUNT_TYPE}.
<p>
The most common case is to call this with one account type, e.g.:
<p>
<pre> newChooseAccountIntent(null, null, new String[]{"com.google"}, null, null, null,
null);</pre>
@param {Object {Account}} selectedAccount if specified, indicates that the {@link Account} is the currently
selected one, according to the caller's definition of selected.
@param {Object {java.util.List}} allowableAccounts an optional {@link List} of accounts that are allowed to be
shown. If not specified then this field will not limit the displayed accounts.
@param {Object {java.lang.String[]}} allowableAccountTypes an optional string array of account types. These are used
both to filter the shown accounts and to filter the list of account types that are shown
when adding an account. If not specified then this field will not limit the displayed
account types when adding an account.
@param {String} descriptionOverrideText if non-null this string is used as the description in the
accounts chooser screen rather than the default
@param {String} addAccountAuthTokenType this string is passed as the {@link #addAccount}
authTokenType parameter
@param {Object {java.lang.String[]}} addAccountRequiredFeatures this string array is passed as the {@link #addAccount}
requiredFeatures parameter
@param {Object {Bundle}} addAccountOptions This {@link Bundle} is passed as the {@link #addAccount} options
parameter
@return {Object {android.content.Intent}} an {@link Intent} that can be used to launch the ChooseAccount activity flow.
*/
newChooseAccountIntent : function( ) {},
/**Adds an {@link android.accounts.OnAccountsUpdateListener} to this instance of the
{@link android.accounts.AccountManager}. This listener will be notified whenever the
list of accounts on the device changes.
<p>As long as this listener is present, the AccountManager instance
will not be garbage-collected, and neither will the {@link Context}
used to retrieve it, which may be a large Activity instance. To avoid
memory leaks, you must remove this listener before then. Normally
listeners are added in an Activity or Service's {@link Activity#onCreate}
and removed in {@link Activity#onDestroy}.
<p>The listener will only be informed of accounts that would be returned
to the caller via {@link #getAccounts}(). Typically this means that to
get any accounts, the caller will need to be grated the GET_ACCOUNTS
permission.
<p>It is safe to call this method from the main thread.
@param {Object {OnAccountsUpdateListener}} listener The listener to send notifications to
@param {Object {Handler}} handler {@link Handler} identifying the thread to use
for notifications, null for the main thread
@param {Boolean} updateImmediately If true, the listener will be invoked
(on the handler thread) right away with the current account list
@throws IllegalArgumentException if listener is null
@throws IllegalStateException if listener was already added
*/
addOnAccountsUpdatedListener : function( ) {},
/**Removes an {@link android.accounts.OnAccountsUpdateListener} previously registered with
{@link #addOnAccountsUpdatedListener}. The listener will no longer
receive notifications of account changes.
<p>It is safe to call this method from the main thread.
<p>No permission is required to call this method.
@param {Object {OnAccountsUpdateListener}} listener The previously added listener to remove
@throws IllegalArgumentException if listener is null
@throws IllegalStateException if listener was not already added
*/
removeOnAccountsUpdatedListener : function( ) {},
};