Aracılığıyla paylaş


AccountManager.ConfirmCredentials Method

Definition

Confirms that the user knows the password for an account to make extra sure they are the owner of the account.

[Android.Runtime.Register("confirmCredentials", "(Landroid/accounts/Account;Landroid/os/Bundle;Landroid/app/Activity;Landroid/accounts/AccountManagerCallback;Landroid/os/Handler;)Landroid/accounts/AccountManagerFuture;", "GetConfirmCredentials_Landroid_accounts_Account_Landroid_os_Bundle_Landroid_app_Activity_Landroid_accounts_AccountManagerCallback_Landroid_os_Handler_Handler")]
[Android.Runtime.RequiresPermission("android.permission.MANAGE_ACCOUNTS")]
public virtual Android.Accounts.IAccountManagerFuture? ConfirmCredentials (Android.Accounts.Account? account, Android.OS.Bundle? options, Android.App.Activity? activity, Android.Accounts.IAccountManagerCallback? callback, Android.OS.Handler? handler);
[<Android.Runtime.Register("confirmCredentials", "(Landroid/accounts/Account;Landroid/os/Bundle;Landroid/app/Activity;Landroid/accounts/AccountManagerCallback;Landroid/os/Handler;)Landroid/accounts/AccountManagerFuture;", "GetConfirmCredentials_Landroid_accounts_Account_Landroid_os_Bundle_Landroid_app_Activity_Landroid_accounts_AccountManagerCallback_Landroid_os_Handler_Handler")>]
[<Android.Runtime.RequiresPermission("android.permission.MANAGE_ACCOUNTS")>]
abstract member ConfirmCredentials : Android.Accounts.Account * Android.OS.Bundle * Android.App.Activity * Android.Accounts.IAccountManagerCallback * Android.OS.Handler -> Android.Accounts.IAccountManagerFuture
override this.ConfirmCredentials : Android.Accounts.Account * Android.OS.Bundle * Android.App.Activity * Android.Accounts.IAccountManagerCallback * Android.OS.Handler -> Android.Accounts.IAccountManagerFuture

Parameters

account
Account

The account to confirm password knowledge for

options
Bundle

Authenticator-specific options for the request; if the #KEY_PASSWORD string field is present, the authenticator may use it directly rather than prompting the user; 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 enter a password; 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 or password was supplied and the account was successfully verified: <ul> <li> #KEY_ACCOUNT_NAME - the name of the account verified <li> #KEY_ACCOUNT_TYPE - the type of the account <li> #KEY_BOOLEAN_RESULT - true to indicate success </ul>

        If no activity or password was specified, the returned Bundle contains
        <code data-dev-comment-type="c">#KEY_INTENT</code> with the <code data-dev-comment-type="c">Intent</code> needed to launch the
        password prompt.

        &lt;p&gt;Also the returning Bundle may contain <code data-dev-comment-type="c">#KEY_LAST_AUTHENTICATED_TIME</code> indicating the last time the
        credential was validated/created.

        If an error occurred,<code data-dev-comment-type="c">AccountManagerFuture#getResult()</code> throws:
        &lt;ul&gt;
        &lt;li&gt; <code data-dev-comment-type="c">AuthenticatorException</code> if the authenticator failed to respond
        &lt;li&gt; <code data-dev-comment-type="c">OperationCanceledException</code> if the operation was canceled for
             any reason, including the user canceling the password prompt
        &lt;li&gt; <code data-dev-comment-type="c">IOException</code> if the authenticator experienced an I/O problem
             verifying the password, usually because of network trouble
        &lt;/ul&gt;
Attributes

Remarks

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.

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).

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

<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.

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