CredentialManager.GetCredential 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| GetCredential(Context, GetCredentialRequest, CancellationSignal, IExecutor, IOutcomeReceiver) |
啟動必要的流程,從使用者那裡取得應用程式憑證。 |
| GetCredential(Context, PrepareGetCredentialResponse+PendingGetCredentialHandle, CancellationSignal, IExecutor, IOutcomeReceiver) |
在完成對應給定待處理的 GetCredentialHandle 預取工作後,啟動剩餘流程以從使用者那裡取得應用程式憑證。 |
GetCredential(Context, GetCredentialRequest, CancellationSignal, IExecutor, IOutcomeReceiver)
啟動必要的流程,從使用者那裡取得應用程式憑證。
[Android.Runtime.Register("getCredential", "(Landroid/content/Context;Landroid/credentials/GetCredentialRequest;Landroid/os/CancellationSignal;Ljava/util/concurrent/Executor;Landroid/os/OutcomeReceiver;)V", "", ApiSince=34)]
public void GetCredential(Android.Content.Context context, Android.Credentials.GetCredentialRequest request, Android.OS.CancellationSignal? cancellationSignal, Java.Util.Concurrent.IExecutor executor, Android.OS.IOutcomeReceiver callback);
[<Android.Runtime.Register("getCredential", "(Landroid/content/Context;Landroid/credentials/GetCredentialRequest;Landroid/os/CancellationSignal;Ljava/util/concurrent/Executor;Landroid/os/OutcomeReceiver;)V", "", ApiSince=34)>]
member this.GetCredential : Android.Content.Context * Android.Credentials.GetCredentialRequest * Android.OS.CancellationSignal * Java.Util.Concurrent.IExecutor * Android.OS.IOutcomeReceiver -> unit
參數
- context
- Context
啟動任何 UI 所需的上下文;使用活動上下文確保使用者介面會在同一任務堆疊中啟動
- request
- GetCredentialRequest
指定使用者要取得的憑證類型請求
- cancellationSignal
- CancellationSignal
一個可選的訊號,允許取消此通話
- executor
- IExecutor
回試將在此進行 Executor
- callback
- IOutcomeReceiver
當請求成功或失敗時所呼叫的回調
- 屬性
備註
啟動必要的流程,從使用者那裡取得應用程式憑證。
執行過程中可能啟動 UI 流程,收集使用者對使用憑證的同意,當存在多個憑證時顯示選擇器等。呼叫者(例如瀏覽器)可選擇為與自己不同的應用程式設定來源 GetCredentialRequest ,以代表該應用程式取得憑證。 他們需要額外權限 CREDENTIAL_MANAGER_SET_ORIGIN 才能使用此功能
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。
適用於
GetCredential(Context, PrepareGetCredentialResponse+PendingGetCredentialHandle, CancellationSignal, IExecutor, IOutcomeReceiver)
在完成對應給定待處理的 GetCredentialHandle 預取工作後,啟動剩餘流程以從使用者那裡取得應用程式憑證。
[Android.Runtime.Register("getCredential", "(Landroid/content/Context;Landroid/credentials/PrepareGetCredentialResponse$PendingGetCredentialHandle;Landroid/os/CancellationSignal;Ljava/util/concurrent/Executor;Landroid/os/OutcomeReceiver;)V", "", ApiSince=34)]
public void GetCredential(Android.Content.Context context, Android.Credentials.PrepareGetCredentialResponse.PendingGetCredentialHandle pendingGetCredentialHandle, Android.OS.CancellationSignal? cancellationSignal, Java.Util.Concurrent.IExecutor executor, Android.OS.IOutcomeReceiver callback);
[<Android.Runtime.Register("getCredential", "(Landroid/content/Context;Landroid/credentials/PrepareGetCredentialResponse$PendingGetCredentialHandle;Landroid/os/CancellationSignal;Ljava/util/concurrent/Executor;Landroid/os/OutcomeReceiver;)V", "", ApiSince=34)>]
member this.GetCredential : Android.Content.Context * Android.Credentials.PrepareGetCredentialResponse.PendingGetCredentialHandle * Android.OS.CancellationSignal * Java.Util.Concurrent.IExecutor * Android.OS.IOutcomeReceiver -> unit
參數
- context
- Context
啟動任何 UI 所需的上下文;使用活動上下文確保使用者介面會在同一個任務堆疊中啟動。 這個值不可能為零值。
- pendingGetCredentialHandle
- PrepareGetCredentialResponse.PendingGetCredentialHandle
該 handle 代表待處理的操作,準備繼續。 這個值不可能為零值。
- cancellationSignal
- CancellationSignal
一個可選的訊號,允許取消此通話。 這個值可能是 Null。
- executor
- IExecutor
回調會在執行者回調上進行,監聽者事件會透過執行器派遣,方便控制使用哪個執行緒。 要透過應用程式的主執行緒派發事件,可以使用 Context.getMainExecutor()。 否則,提供一個執行者,將執行者派遣到適當的執行緒。 這個值不可能為零值。
- callback
- IOutcomeReceiver
當請求成功或失敗時會呼叫回調。 這個值不可能為零值。
- 屬性
備註
在完成對應給定待處理的 GetCredentialHandle 預取工作後,啟動剩餘流程以從使用者那裡取得應用程式憑證。
執行過程中可能啟動 UI 流程,收集使用者對使用憑證的同意,當多個憑證存在時顯示選擇器等。
使用此 API 完成完整的憑證檢索操作,當您透過 prepareGetCredential(GetCredentialRequest, CancellationSignal, Executor, OutcomeReceiver) API 發起請求後。
Android 參考資料。android.credentials.CredentialManager.getCredential
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。