AccountManager.StartAddAccountSession Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Asks the user to authenticate with an account of a specified type.
[Android.Runtime.Register("startAddAccountSession", "(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Landroid/os/Bundle;Landroid/app/Activity;Landroid/accounts/AccountManagerCallback;Landroid/os/Handler;)Landroid/accounts/AccountManagerFuture;", "GetStartAddAccountSession_Ljava_lang_String_Ljava_lang_String_arrayLjava_lang_String_Landroid_os_Bundle_Landroid_app_Activity_Landroid_accounts_AccountManagerCallback_Landroid_os_Handler_Handler", ApiSince=26)]
public virtual Android.Accounts.IAccountManagerFuture? StartAddAccountSession (string? accountType, string? authTokenType, string[]? requiredFeatures, Android.OS.Bundle? options, Android.App.Activity? activity, Android.Accounts.IAccountManagerCallback? callback, Android.OS.Handler? handler);
[<Android.Runtime.Register("startAddAccountSession", "(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Landroid/os/Bundle;Landroid/app/Activity;Landroid/accounts/AccountManagerCallback;Landroid/os/Handler;)Landroid/accounts/AccountManagerFuture;", "GetStartAddAccountSession_Ljava_lang_String_Ljava_lang_String_arrayLjava_lang_String_Landroid_os_Bundle_Landroid_app_Activity_Landroid_accounts_AccountManagerCallback_Landroid_os_Handler_Handler", ApiSince=26)>]
abstract member StartAddAccountSession : string * string * string[] * Android.OS.Bundle * Android.App.Activity * Android.Accounts.IAccountManagerCallback * Android.OS.Handler -> Android.Accounts.IAccountManagerFuture
override this.StartAddAccountSession : string * string * string[] * Android.OS.Bundle * Android.App.Activity * Android.Accounts.IAccountManagerCallback * Android.OS.Handler -> Android.Accounts.IAccountManagerFuture
Parameters
- accountType
- String
The type of account to add; must not be null
- authTokenType
- String
The type of auth token (see #getAuthToken
)
this account will need to be able to generate, null for none
- requiredFeatures
- String[]
The features (see #hasFeatures
) this
account must have, null for none
- options
- Bundle
Authenticator-specific options for the request, may be null or empty
- activity
- Activity
The 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
Intent
will be returned to the caller instead
- callback
- IAccountManagerCallback
Callback to invoke when the request completes, null for no callback
- handler
- Handler
Handler
identifying the callback thread, null for
the main thread
Returns
An AccountManagerFuture
which resolves to a Bundle with
these fields if activity was specified and user was authenticated
with an account:
<ul>
<li>#KEY_ACCOUNT_SESSION_BUNDLE
- encrypted Bundle for
adding the the to the device later.
<li>#KEY_ACCOUNT_STATUS_TOKEN
- optional, token to check
status of the account
</ul>
If no activity was specified, the returned Bundle contains only
#KEY_INTENT
with the Intent
needed to launch the
actual account creation process. If authenticator doesn't support
this method, the returned Bundle contains only
#KEY_ACCOUNT_SESSION_BUNDLE
with encrypted
options
needed to add account later. If an error
occurred, AccountManagerFuture#getResult()
throws:
<ul>
<li>AuthenticatorException
if no authenticator was
registered for this account type or the authenticator failed to
respond
<li>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>IOException
if the authenticator experienced an I/O
problem creating a new account, usually because of network
trouble
</ul>
- Attributes
Remarks
Asks the user to authenticate with 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 authenticate with a new account, a bundle of session data for installing the account later is returned with optional account password and account status token.
This method may be called from any thread, but the returned AccountManagerFuture
must not be used on the main thread.
<b>NOTE:</b> The account will not be installed to the device by calling this api alone. #finishSession should be called after this to install the account on device.
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.