Dataset.Builder.SetAuthentication(IntentSender) 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.
Triggers a custom UI before autofilling the screen with the contents of this dataset.
[Android.Runtime.Register("setAuthentication", "(Landroid/content/IntentSender;)Landroid/service/autofill/Dataset$Builder;", "", ApiSince=26)]
public Android.Service.Autofill.Dataset.Builder SetAuthentication(Android.Content.IntentSender? authentication);
[<Android.Runtime.Register("setAuthentication", "(Landroid/content/IntentSender;)Landroid/service/autofill/Dataset$Builder;", "", ApiSince=26)>]
member this.SetAuthentication : Android.Content.IntentSender -> Android.Service.Autofill.Dataset.Builder
Parameters
- authentication
- IntentSender
Intent to an activity with your authentication flow. This value may be null.
Returns
this builder. This value cannot be null.
- Attributes
Remarks
Triggers a custom UI before autofilling the screen with the contents of this dataset.
Note: Although the name of this method suggests that it should be used just for authentication flow, it can be used for other advanced flows; see AutofillService for examples.
This method is called when you need to provide an authentication UI for the data set. For example, when a data set contains credit card information (such as number, expiration date, and verification code), you can display UI asking for the verification code before filing in the data. Even if the data set is completely populated the system will launch the specified authentication intent and will need your approval to fill it in. Since the data set is "locked" until the user authenticates it, typically this data set name is masked (for example, "VISA....1234"). Typically you would want to store the data set labels non-encrypted and the actual sensitive data encrypted and not in memory. This allows showing the labels in the UI while involving the user if one of the items with these labels is chosen. Note that if you use sensitive data as a label, for example an email address, then it should also be encrypted.
When a user triggers autofill, the system launches the provided intent whose extras will have the screen content, and your client state. Once you complete your authentication flow you should set the activity result to Activity.RESULT_OK and provide the fully populated dataset or a fully-populated response by setting it to the AutofillManager.EXTRA_AUTHENTICATION_RESULT extra. If you provide a dataset in the result, it will replace the authenticated dataset and will be immediately filled in. An exception to this behavior is if the original dataset represents a pinned inline suggestion (i.e. any of the field in the dataset has a pinned inline presentation, see InlinePresentation.isPinned()), then the original dataset will not be replaced, so that it can be triggered as a pending intent again. If you provide a response, it will replace the current response and the UI will be refreshed. For example, if you provided credit card information without the CVV for the data set in the response then the returned data set should contain the CVV entry.
Note: Do not make the provided pending intent immutable by using PendingIntent.FLAG_IMMUTABLE as the platform needs to fill in the authentication arguments.
Android reference for android.service.autofill.Dataset.Builder.setAuthentication.
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.