Sdílet prostřednictvím


CredentialManager.CreateCredential Method

Definition

Launches the necessary flows to register an app credential for the user.

[Android.Runtime.Register("createCredential", "(Landroid/content/Context;Landroid/credentials/CreateCredentialRequest;Landroid/os/CancellationSignal;Ljava/util/concurrent/Executor;Landroid/os/OutcomeReceiver;)V", "", ApiSince=34)]
public void CreateCredential (Android.Content.Context context, Android.Credentials.CreateCredentialRequest request, Android.OS.CancellationSignal? cancellationSignal, Java.Util.Concurrent.IExecutor executor, Android.OS.IOutcomeReceiver callback);
[<Android.Runtime.Register("createCredential", "(Landroid/content/Context;Landroid/credentials/CreateCredentialRequest;Landroid/os/CancellationSignal;Ljava/util/concurrent/Executor;Landroid/os/OutcomeReceiver;)V", "", ApiSince=34)>]
member this.CreateCredential : Android.Content.Context * Android.Credentials.CreateCredentialRequest * 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
CreateCredentialRequest

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 register an app credential for the user.

The execution can potentially launch UI flows to collect user consent to creating or storing the new credential, etc. Callers (e.g. browsers) may optionally set origin in CreateCredentialRequest 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

Java documentation for android.credentials.CredentialManager.createCredential(android.content.Context, android.credentials.CreateCredentialRequest, android.os.CancellationSignal, java.util.concurrent.Executor, android.os.OutcomeReceiver<android.credentials.CreateCredentialResponse, android.credentials.CreateCredentialException>).

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