Freigeben über


AccountManager.FinishSession Method

Definition

Finishes the session started by #startAddAccountSession or #startUpdateCredentialsSession.

[Android.Runtime.Register("finishSession", "(Landroid/os/Bundle;Landroid/app/Activity;Landroid/accounts/AccountManagerCallback;Landroid/os/Handler;)Landroid/accounts/AccountManagerFuture;", "GetFinishSession_Landroid_os_Bundle_Landroid_app_Activity_Landroid_accounts_AccountManagerCallback_Landroid_os_Handler_Handler", ApiSince=26)]
public virtual Android.Accounts.IAccountManagerFuture? FinishSession (Android.OS.Bundle? sessionBundle, Android.App.Activity? activity, Android.Accounts.IAccountManagerCallback? callback, Android.OS.Handler? handler);
[<Android.Runtime.Register("finishSession", "(Landroid/os/Bundle;Landroid/app/Activity;Landroid/accounts/AccountManagerCallback;Landroid/os/Handler;)Landroid/accounts/AccountManagerFuture;", "GetFinishSession_Landroid_os_Bundle_Landroid_app_Activity_Landroid_accounts_AccountManagerCallback_Landroid_os_Handler_Handler", ApiSince=26)>]
abstract member FinishSession : Android.OS.Bundle * Android.App.Activity * Android.Accounts.IAccountManagerCallback * Android.OS.Handler -> Android.Accounts.IAccountManagerFuture
override this.FinishSession : Android.OS.Bundle * Android.App.Activity * Android.Accounts.IAccountManagerCallback * Android.OS.Handler -> Android.Accounts.IAccountManagerFuture

Parameters

sessionBundle
Bundle

a Bundle created by #startAddAccountSession or #startUpdateCredentialsSession

activity
Activity

The Activity context to use for launching a new authenticator-defined sub-Activity to prompt the user to create an account or reauthenticate existing 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 an activity was supplied and an account was added to device or local credentials were updated:: <ul> <li>#KEY_ACCOUNT_NAME - the name of the account created <li>#KEY_ACCOUNT_TYPE - the type of the account <li>#KEY_ACCOUNT_STATUS_TOKEN - optional, token to check status of the account </ul> If no activity was specified and additional information is needed from user, the returned Bundle may only contain #KEY_INTENT with the Intent needed to launch the actual account creation process. 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

Finishes the session started by #startAddAccountSession or #startUpdateCredentialsSession. This will either add the account to AccountManager or update the local credentials stored.

This method may be called from any thread, but the returned AccountManagerFuture must not be used on the main thread.

Java documentation for android.accounts.AccountManager.finishSession(android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler).

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