AccountManager.UpdateCredentials 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
會要求使用者輸入新密碼,更新該帳號儲存的憑證。
[Android.Runtime.Register("updateCredentials", "(Landroid/accounts/Account;Ljava/lang/String;Landroid/os/Bundle;Landroid/app/Activity;Landroid/accounts/AccountManagerCallback;Landroid/os/Handler;)Landroid/accounts/AccountManagerFuture;", "GetUpdateCredentials_Landroid_accounts_Account_Ljava_lang_String_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? UpdateCredentials(Android.Accounts.Account? account, string? authTokenType, Android.OS.Bundle? options, Android.App.Activity? activity, Android.Accounts.IAccountManagerCallback? callback, Android.OS.Handler? handler);
[<Android.Runtime.Register("updateCredentials", "(Landroid/accounts/Account;Ljava/lang/String;Landroid/os/Bundle;Landroid/app/Activity;Landroid/accounts/AccountManagerCallback;Landroid/os/Handler;)Landroid/accounts/AccountManagerFuture;", "GetUpdateCredentials_Landroid_accounts_Account_Ljava_lang_String_Landroid_os_Bundle_Landroid_app_Activity_Landroid_accounts_AccountManagerCallback_Landroid_os_Handler_Handler")>]
[<Android.Runtime.RequiresPermission("android.permission.MANAGE_ACCOUNTS")>]
abstract member UpdateCredentials : Android.Accounts.Account * string * Android.OS.Bundle * Android.App.Activity * Android.Accounts.IAccountManagerCallback * Android.OS.Handler -> Android.Accounts.IAccountManagerFuture
override this.UpdateCredentials : Android.Accounts.Account * string * Android.OS.Bundle * Android.App.Activity * Android.Accounts.IAccountManagerCallback * Android.OS.Handler -> Android.Accounts.IAccountManagerFuture
參數
- account
- Account
更新帳號的帳號
- authTokenType
- String
輸入的憑證必須允許建立此類認證憑證(但不會回傳實際的認證憑證);可能是空
- options
- Bundle
驗證器專用的請求選項;可能是空或空
- activity
- Activity
Activity用於啟動新認證者定義子活動的上下文,提示使用者輸入密碼;僅用於呼叫 startActivity();若為空,提示不會直接啟動,而是Intent回傳給呼叫者
- callback
- IAccountManagerCallback
請求完成時回調以呼叫,無回撥則為 null
- handler
- Handler
Handler 識別回調執行緒,主執行緒為 null
傳回
AccountManagerFuture如果有活動被提供且帳號憑證已成功更新,則解析為包含以下欄位的 Bundle:<ul><li#KEY_ACCOUNT_NAME> - 帳號<名稱 li>#KEY_ACCOUNT_TYPE - 帳號<類型 /ul>
If no activity 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. If an error occurred,
<code data-dev-comment-type="c">AccountManagerFuture#getResult()</code> throws:
<ul>
<li> <code data-dev-comment-type="c">AuthenticatorException</code> if the authenticator failed to respond
<li> <code data-dev-comment-type="c">OperationCanceledException</code> if the operation was canceled for
any reason, including the user canceling the password prompt
<li> <code data-dev-comment-type="c">IOException</code> if the authenticator experienced an I/O problem
verifying the password, usually because of network trouble
</ul>
- 屬性
備註
會要求使用者輸入新密碼,更新該帳號儲存的憑證。 通常當伺服器在驗證令牌擷取時拒絕憑證時會自動發生,但也可以直接啟動,以確保憑證儲存正確。
此方法可從任何執行緒呼叫,但回傳 AccountManagerFuture 的程式碼不得用於主執行緒。
<b>注意:</b> 若您的應用程式目標是在 API 22 級及之前運作,則需取得MANAGE_ACCOUNTS權限。 請參閱 API 等級 22 的相關文件。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。