CredentialManager.GetCredential Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| GetCredential(Context, GetCredentialRequest, CancellationSignal, IExecutor, IOutcomeReceiver) |
Launches the necessary flows to retrieve an app credential from the user. |
| GetCredential(Context, PrepareGetCredentialResponse+PendingGetCredentialHandle, CancellationSignal, IExecutor, IOutcomeReceiver) |
Launches the remaining flows to retrieve an app credential from the user, after the completed prefetch work corresponding to the given pendingGetCredentialHandle. |
GetCredential(Context, GetCredentialRequest, CancellationSignal, IExecutor, IOutcomeReceiver)
Launches the necessary flows to retrieve an app credential from the user.
[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
Parameters
- context
- Context
the context used to launch any UI needed; use an activity context to make sure the UI will be launched within the same task stack
- request
- GetCredentialRequest
the request specifying type(s) of credentials to get from the user
- cancellationSignal
- CancellationSignal
an optional signal that allows for cancelling this call
- executor
- IExecutor
the callback will take place on this Executor
- callback
- IOutcomeReceiver
the callback invoked when the request succeeds or fails
- Attributes
Remarks
Launches the necessary flows to retrieve an app credential from the user.
The execution can potentially launch UI flows to collect user consent to using a credential, display a picker when multiple credentials exist, etc. Callers (e.g. browsers) may optionally set origin in GetCredentialRequest for an app different from their own, to be able to get credentials on behalf of that app. They would need additional permission CREDENTIAL_MANAGER_SET_ORIGIN to use this functionality
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
GetCredential(Context, PrepareGetCredentialResponse+PendingGetCredentialHandle, CancellationSignal, IExecutor, IOutcomeReceiver)
Launches the remaining flows to retrieve an app credential from the user, after the completed prefetch work corresponding to the given pendingGetCredentialHandle.
[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
Parameters
- context
- Context
the context used to launch any UI needed; use an activity context to make sure the UI will be launched within the same task stack. This value cannot be null.
- pendingGetCredentialHandle
- PrepareGetCredentialResponse.PendingGetCredentialHandle
the handle representing the pending operation to resume. This value cannot be null.
- cancellationSignal
- CancellationSignal
an optional signal that allows for cancelling this call. This value may be null.
- executor
- IExecutor
the callback will take place on this Executor Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread. This value cannot be null.
- callback
- IOutcomeReceiver
the callback invoked when the request succeeds or fails. This value cannot be null.
- Attributes
Remarks
Launches the remaining flows to retrieve an app credential from the user, after the completed prefetch work corresponding to the given pendingGetCredentialHandle.
The execution can potentially launch UI flows to collect user consent to using a credential, display a picker when multiple credentials exist, etc.
Use this API to complete the full credential retrieval operation after you initiated a request through the prepareGetCredential(GetCredentialRequest,CancellationSignal,Executor,OutcomeReceiver) API.
Android reference for android.credentials.CredentialManager.getCredential.
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.