共用方式為


AccountManager.ConfirmCredentials 方法

定義

確認使用者知道帳戶的密碼,以確保他們是帳戶的擁有者。

[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

參數

account
Account

用來確認密碼知識的帳戶

options
Bundle

要求的驗證器特定選項; #KEY_PASSWORD 如果字串欄位存在,驗證器可能會直接使用它,而不是提示使用者;可能是 Null 或空白

activity
Activity

Activity用來啟動新的驗證器定義子活動的內容,以提示使用者輸入密碼;僅用來呼叫 startActivity():如果為 null,則不會直接啟動提示,但必要Intent專案會改為傳回給呼叫端

callback
IAccountManagerCallback

要求完成時叫用的回呼,無回呼為 null

handler
Handler

Handler 識別主線程的回呼線程,為 null 表示主線程

傳回

AccountManagerFuture如果已提供活動或密碼,且帳戶已成功驗證:<ul><li>#KEY_ACCOUNT_NAME - 帳戶已驗證 <li#KEY_ACCOUNT_TYPE> - 帳戶 li - 帳戶 li - 帳戶 <li>#KEY_BOOLEAN_RESULT 的類型 - true 表示成功 </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;
屬性

備註

確認使用者知道帳戶的密碼,以確保他們是帳戶的擁有者。 您可以直接提供使用者輸入的密碼,否則此帳戶類型的驗證器會提示使用者輸入適當的介面。 此方法適用於想要額外保證的應用程式;例如,如果手機鎖定畫面忘記鎖定模式,則手機鎖定畫面會使用此畫面讓使用者使用帳戶密碼解除鎖定。

如果使用者輸入的密碼符合此帳戶的已儲存密碼,則會將要求視為有效;否則,驗證器會驗證密碼(通常是透過連絡伺服器)。

這個方法可以從任何線程呼叫,但傳回 AccountManagerFuture 的 不得在主線程上使用。

<b>注意:</b> 如果您的應用程式以 API 層級 22 和之前版本為目標,則這些平臺需要MANAGE_ACCOUNTS許可權。 請參閱 API 層級 22 中此函式的檔。

android.accounts.AccountManager.confirmCredentials(android.accounts.Account, android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler)Java 檔。

此頁面的部分是根據 Android 開放原始碼專案所建立和共用的工作進行修改,並根據 Creative Commons 2.5 屬性授權中所述的詞彙使用。

適用於