FillResponse.Builder.SetAuthentication 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 |
|---|---|
| SetAuthentication(AutofillId[], IntentSender, Presentations) |
Triggers a custom UI before autofilling the screen with any data set in this response. |
| SetAuthentication(AutofillId[], IntentSender, RemoteViews) |
Triggers a custom UI before autofilling the screen with any data set in this response. |
| SetAuthentication(AutofillId[], IntentSender, RemoteViews, InlinePresentation) |
Triggers a custom UI before autofilling the screen with any data set in this response. |
| SetAuthentication(AutofillId[], IntentSender, RemoteViews, InlinePresentation, InlinePresentation) |
Triggers a custom UI before autofilling the screen with any data set in this response. |
SetAuthentication(AutofillId[], IntentSender, Presentations)
Triggers a custom UI before autofilling the screen with any data set in this response.
[Android.Runtime.Register("setAuthentication", "([Landroid/view/autofill/AutofillId;Landroid/content/IntentSender;Landroid/service/autofill/Presentations;)Landroid/service/autofill/FillResponse$Builder;", "", ApiSince=33)]
public Android.Service.Autofill.FillResponse.Builder SetAuthentication(Android.Views.Autofill.AutofillId[] ids, Android.Content.IntentSender? authentication, Android.Service.Autofill.Presentations? presentations);
[<Android.Runtime.Register("setAuthentication", "([Landroid/view/autofill/AutofillId;Landroid/content/IntentSender;Landroid/service/autofill/Presentations;)Landroid/service/autofill/FillResponse$Builder;", "", ApiSince=33)>]
member this.SetAuthentication : Android.Views.Autofill.AutofillId[] * Android.Content.IntentSender * Android.Service.Autofill.Presentations -> Android.Service.Autofill.FillResponse.Builder
Parameters
- ids
- AutofillId[]
id of Views that when focused will display the authentication UI. This value cannot be null.
- authentication
- IntentSender
Intent to an activity with your authentication flow. This value may be null.
- presentations
- Presentations
The presentations to visualize the response. This value may be null.
Returns
This builder.
- Attributes
Remarks
Triggers a custom UI before autofilling the screen with any data set in this response.
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 is typically useful when a user interaction is required to unlock their data vault if you encrypt the data set labels and data set data. It is recommended to encrypt only the sensitive data and not the data set labels which would allow auth on the data set level leading to a better user experience. Note that if you use sensitive data as a label, for example an email address, then it should also be encrypted. The provided intent must be an Activity which implements your authentication flow. Also if you provide an auth intent you also need to specify the presentation view to be shown in the fill UI for the user to trigger your authentication flow.
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 set the AutofillManager.EXTRA_AUTHENTICATION_RESULT extra with the fully populated response (or null if the screen cannot be autofilled).
For example, if you provided an empty response because the user's data was locked and marked that the response needs an authentication then in the response returned if authentication succeeds you need to provide all available data sets some of which may need to be further authenticated, for example a credit card whose CVV needs to be entered.
If you provide an authentication intent you must also provide a presentation which is used to visualize the response for triggering the authentication flow.
Note: Do not make the provided pending intent immutable by using PendingIntent.FLAG_IMMUTABLE as the platform needs to fill in the authentication arguments.
Note: setHeader(RemoteViews) or setFooter(RemoteViews) does not work with InlinePresentation.
Android reference for android.service.autofill.FillResponse.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.
Applies to
SetAuthentication(AutofillId[], IntentSender, RemoteViews)
Triggers a custom UI before autofilling the screen with any data set in this response.
[Android.Runtime.Register("setAuthentication", "([Landroid/view/autofill/AutofillId;Landroid/content/IntentSender;Landroid/widget/RemoteViews;)Landroid/service/autofill/FillResponse$Builder;", "", ApiSince=26)]
public Android.Service.Autofill.FillResponse.Builder SetAuthentication(Android.Views.Autofill.AutofillId[] ids, Android.Content.IntentSender? authentication, Android.Widget.RemoteViews? presentation);
[<Android.Runtime.Register("setAuthentication", "([Landroid/view/autofill/AutofillId;Landroid/content/IntentSender;Landroid/widget/RemoteViews;)Landroid/service/autofill/FillResponse$Builder;", "", ApiSince=26)>]
member this.SetAuthentication : Android.Views.Autofill.AutofillId[] * Android.Content.IntentSender * Android.Widget.RemoteViews -> Android.Service.Autofill.FillResponse.Builder
Parameters
- ids
- AutofillId[]
id of Views that when focused will display the authentication UI. This value cannot be null.
- authentication
- IntentSender
Intent to an activity with your authentication flow. This value may be null.
- presentation
- RemoteViews
The presentation to visualize the response. This value may be null.
Returns
This builder.
- Attributes
Remarks
This method was deprecated in API level 33. Use setAuthentication(AutofillId[],IntentSender,Presentations) instead.
Triggers a custom UI before autofilling the screen with any data set in this response.
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 is typically useful when a user interaction is required to unlock their data vault if you encrypt the data set labels and data set data. It is recommended to encrypt only the sensitive data and not the data set labels which would allow auth on the data set level leading to a better user experience. Note that if you use sensitive data as a label, for example an email address, then it should also be encrypted. The provided intent must be an Activity which implements your authentication flow. Also if you provide an auth intent you also need to specify the presentation view to be shown in the fill UI for the user to trigger your authentication flow.
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 set the AutofillManager.EXTRA_AUTHENTICATION_RESULT extra with the fully populated response (or null if the screen cannot be autofilled).
IMPORTANT: Extras must be non-null on the intent being set for Android 12 otherwise it will cause a crash. Do not use Activity.setResult(int), instead use Activity.setResult(int,Intent) with non-null extras. Consider setting AutofillManager.EXTRA_AUTHENTICATION_RESULT to null or use Bundle.EMPTY with Intent.putExtras(Bundle) on the intent when finishing activity to avoid crash).
For example, if you provided an empty response because the user's data was locked and marked that the response needs an authentication then in the response returned if authentication succeeds you need to provide all available data sets some of which may need to be further authenticated, for example a credit card whose CVV needs to be entered.
If you provide an authentication intent you must also provide a presentation which is used to visualize the response for triggering the authentication flow.
Note: Do not make the provided pending intent immutable by using PendingIntent.FLAG_IMMUTABLE as the platform needs to fill in the authentication arguments.
Theme does not work with RemoteViews layout. Avoid hardcoded text color or background color: Autofill on different platforms may have different themes.
Android reference for android.service.autofill.FillResponse.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.
Applies to
SetAuthentication(AutofillId[], IntentSender, RemoteViews, InlinePresentation)
Triggers a custom UI before autofilling the screen with any data set in this response.
[Android.Runtime.Register("setAuthentication", "([Landroid/view/autofill/AutofillId;Landroid/content/IntentSender;Landroid/widget/RemoteViews;Landroid/service/autofill/InlinePresentation;)Landroid/service/autofill/FillResponse$Builder;", "", ApiSince=30)]
public Android.Service.Autofill.FillResponse.Builder SetAuthentication(Android.Views.Autofill.AutofillId[] ids, Android.Content.IntentSender? authentication, Android.Widget.RemoteViews? presentation, Android.Service.Autofill.InlinePresentation? inlinePresentation);
[<Android.Runtime.Register("setAuthentication", "([Landroid/view/autofill/AutofillId;Landroid/content/IntentSender;Landroid/widget/RemoteViews;Landroid/service/autofill/InlinePresentation;)Landroid/service/autofill/FillResponse$Builder;", "", ApiSince=30)>]
member this.SetAuthentication : Android.Views.Autofill.AutofillId[] * Android.Content.IntentSender * Android.Widget.RemoteViews * Android.Service.Autofill.InlinePresentation -> Android.Service.Autofill.FillResponse.Builder
Parameters
- ids
- AutofillId[]
id of Views that when focused will display the authentication UI. This value cannot be null.
- authentication
- IntentSender
Intent to an activity with your authentication flow. This value may be null.
- presentation
- RemoteViews
The presentation to visualize the response. This value may be null.
- inlinePresentation
- InlinePresentation
The inlinePresentation to visualize the response inline. This value may be null.
Returns
This builder. This value cannot be null.
- Attributes
Remarks
This method was deprecated in API level 33. Use setAuthentication(AutofillId[],IntentSender,Presentations) instead.
Triggers a custom UI before autofilling the screen with any data set in this response.
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 similar to setAuthentication(AutofillId[],IntentSender,RemoteViews), but also accepts an InlinePresentation presentation which is required for authenticating through the inline autofill flow.
Note: setHeader(RemoteViews) or setFooter(RemoteViews) does not work with InlinePresentation.
Android reference for android.service.autofill.FillResponse.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.
Applies to
SetAuthentication(AutofillId[], IntentSender, RemoteViews, InlinePresentation, InlinePresentation)
Triggers a custom UI before autofilling the screen with any data set in this response.
[Android.Runtime.Register("setAuthentication", "([Landroid/view/autofill/AutofillId;Landroid/content/IntentSender;Landroid/widget/RemoteViews;Landroid/service/autofill/InlinePresentation;Landroid/service/autofill/InlinePresentation;)Landroid/service/autofill/FillResponse$Builder;", "", ApiSince=31)]
public Android.Service.Autofill.FillResponse.Builder SetAuthentication(Android.Views.Autofill.AutofillId[] ids, Android.Content.IntentSender? authentication, Android.Widget.RemoteViews? presentation, Android.Service.Autofill.InlinePresentation? inlinePresentation, Android.Service.Autofill.InlinePresentation? inlineTooltipPresentation);
[<Android.Runtime.Register("setAuthentication", "([Landroid/view/autofill/AutofillId;Landroid/content/IntentSender;Landroid/widget/RemoteViews;Landroid/service/autofill/InlinePresentation;Landroid/service/autofill/InlinePresentation;)Landroid/service/autofill/FillResponse$Builder;", "", ApiSince=31)>]
member this.SetAuthentication : Android.Views.Autofill.AutofillId[] * Android.Content.IntentSender * Android.Widget.RemoteViews * Android.Service.Autofill.InlinePresentation * Android.Service.Autofill.InlinePresentation -> Android.Service.Autofill.FillResponse.Builder
Parameters
- ids
- AutofillId[]
- authentication
- IntentSender
- presentation
- RemoteViews
- inlinePresentation
- InlinePresentation
- inlineTooltipPresentation
- InlinePresentation
Returns
- Attributes
Remarks
This method was deprecated in API level 33. Use setAuthentication(AutofillId[],IntentSender,Presentations) instead.
Triggers a custom UI before autofilling the screen with any data set in this response.
This method like setAuthentication(AutofillId[],IntentSender,RemoteViews,InlinePresentation) but allows setting an InlinePresentation for the inline suggestion tooltip.
Android reference for android.service.autofill.FillResponse.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.