語言

FillResponse.Builder.SetAuthentication 方法

定義

多載

名稱 Description
SetAuthentication(AutofillId[], IntentSender, Presentations)

在自動填滿這個回應中的任何資料集前,會觸發自訂介面。

SetAuthentication(AutofillId[], IntentSender, RemoteViews)

在自動填滿這個回應中的任何資料集前,會觸發自訂介面。

SetAuthentication(AutofillId[], IntentSender, RemoteViews, InlinePresentation)

在自動填滿這個回應中的任何資料集前,會觸發自訂介面。

SetAuthentication(AutofillId[], IntentSender, RemoteViews, InlinePresentation, InlinePresentation)

在自動填滿這個回應中的任何資料集前,會觸發自訂介面。

SetAuthentication(AutofillId[], IntentSender, Presentations)

在自動填滿這個回應中的任何資料集前,會觸發自訂介面。

[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

參數

ids
AutofillId[]

當 Views 聚焦時,會顯示驗證介面的 ID。 這個值不可能為零值。

authentication
IntentSender

與你的認證流程相關的活動意圖。 這個值可能是 Null。

presentations
Presentations

透過簡報來視覺化回應。 這個值可能是 Null。

傳回

這個建築商。

屬性

備註

在自動填滿這個回應中的任何資料集前,會觸發自訂介面。

注意:雖然此方法名稱暗示僅用於認證流程,但它也可用於其他進階流程;範例請參見 AutofillService。

當你需要使用者互動以解鎖資料庫時,這通常很有用,前提是你加密了資料集標籤和資料集資料。 建議只加密敏感資料,而非資料集標籤,這樣才能在資料集層級進行認證,提升使用者體驗。 請注意,如果你使用敏感資料作為標籤,例如電子郵件地址,也應該加密。 所提供的意圖必須是實作你的認證流程的活動。 另外,如果你提供認證意圖,也需要指定填入介面中要顯示的呈現視圖,讓使用者觸發你的認證流程。

當使用者觸發自動填充時,系統會啟動所提供的意圖,其額外內容會包含螢幕內容和你的客戶端狀態。 完成驗證流程後,你應該把活動結果設為Activity.RESULT_OK,並用完整回覆AutofillManager.EXTRA_AUTHENTICATION_RESULT(或如果畫面無法自動填入,則設為 null)。

舉例來說,如果你因為使用者資料被鎖定且被標記為需要驗證而回應為空回應,那麼如果驗證成功,回傳的回應中你必須提供所有可用的資料集,其中有些可能需要進一步驗證,例如一張信用卡的 CVV 需要輸入。

如果你提供認證意圖,也必須提供一個簡報,用來視覺化觸發驗證流程的回應。

注意:請勿透過使用 PendingIntent.FLAG_IMMUTABLE 使所提供的待處理意圖變為不可變,因為平台需要填寫認證參數。

注意:setHeader(RemoteViews)或 setFooter(RemoteViews)無法與 InlinePresentation 相容。

Android 參考資料。android.service.autofill.FillResponse.Builder.setAuthentication

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於

SetAuthentication(AutofillId[], IntentSender, RemoteViews)

在自動填滿這個回應中的任何資料集前,會觸發自訂介面。

[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

參數

ids
AutofillId[]

當 Views 聚焦時,會顯示驗證介面的 ID。 這個值不可能為零值。

authentication
IntentSender

與你的認證流程相關的活動意圖。 這個值可能是 Null。

presentation
RemoteViews

透過簡報來視覺化回應。 這個值可能是 Null。

傳回

這個建築商。

屬性

備註

此方法在 API 等級 33 中被棄用。 改用 setAuthentication(AutofillId[],IntentSender,Presentations)。

在自動填滿這個回應中的任何資料集前,會觸發自訂介面。

注意:雖然此方法名稱暗示僅用於認證流程,但它也可用於其他進階流程;範例請參見 AutofillService。

當你需要使用者互動以解鎖資料庫時,這通常很有用,前提是你加密了資料集標籤和資料集資料。 建議只加密敏感資料,而非資料集標籤,這樣才能在資料集層級進行認證,提升使用者體驗。 請注意,如果你使用敏感資料作為標籤,例如電子郵件地址,也應該加密。 所提供的意圖必須是實作你的認證流程的活動。 另外,如果你提供認證意圖,也需要指定填入介面中要顯示的呈現視圖,讓使用者觸發你的認證流程。

當使用者觸發自動填充時,系統會啟動所提供的意圖,其額外內容會包含螢幕內容和你的客戶端狀態。 完成驗證流程後,你應該把活動結果設為Activity.RESULT_OK,並用完整回覆AutofillManager.EXTRA_AUTHENTICATION_RESULT(或如果畫面無法自動填入,則設為 null)。

重要提示:Android 12 的 Extra 必須在意圖中保持非空,否則會導致當機。 不要使用 Activity.setResult(int),而是使用 Activity.setResult(int,Intent),並使用非空的額外資料。 可以考慮將 AutofillManager.EXTRA_AUTHENTICATION_RESULT 設為 null,或在完成活動時使用 Bundle.EMPTY 搭配 Intent.putExtras(Bundle),以避免當機。

舉例來說,如果你因為使用者資料被鎖定且被標記為需要驗證而回應為空回應,那麼如果驗證成功,回傳的回應中你必須提供所有可用的資料集,其中有些可能需要進一步驗證,例如一張信用卡的 CVV 需要輸入。

如果你提供認證意圖,也必須提供一個簡報,用來視覺化觸發驗證流程的回應。

注意:請勿透過使用 PendingIntent.FLAG_IMMUTABLE 使所提供的待處理意圖變為不可變,因為平台需要填寫認證參數。

主題無法與 RemoteViews 的版面配置相容。 避免硬編碼文字顏色或背景色:不同平台的自動填充可能有不同的主題。

Android 參考資料。android.service.autofill.FillResponse.Builder.setAuthentication

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於

SetAuthentication(AutofillId[], IntentSender, RemoteViews, 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)]
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

參數

ids
AutofillId[]

當 Views 聚焦時,會顯示驗證介面的 ID。 這個值不可能為零值。

authentication
IntentSender

與你的認證流程相關的活動意圖。 這個值可能是 Null。

presentation
RemoteViews

透過簡報來視覺化回應。 這個值可能是 Null。

inlinePresentation
InlinePresentation

InlinePresentation 用來視覺化回應。 這個值可能是 Null。

傳回

這個建築商。 這個值不可能為零值。

屬性

備註

此方法在 API 等級 33 中被棄用。 改用 setAuthentication(AutofillId[],IntentSender,Presentations)。

在自動填滿這個回應中的任何資料集前,會觸發自訂介面。

注意:雖然此方法名稱暗示僅用於認證流程,但它也可用於其他進階流程;範例請參見 AutofillService。

此方法類似於 setAuthentication(AutofillId[],IntentSender,RemoteViews),但也接受 InlinePresentation 呈現,這是透過內嵌自動填充流程進行認證所必需的。

注意:setHeader(RemoteViews)或 setFooter(RemoteViews)無法與 InlinePresentation 相容。

Android 參考資料。android.service.autofill.FillResponse.Builder.setAuthentication

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於

SetAuthentication(AutofillId[], IntentSender, RemoteViews, InlinePresentation, InlinePresentation)

在自動填滿這個回應中的任何資料集前,會觸發自訂介面。

[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

參數

ids
AutofillId[]
authentication
IntentSender
presentation
RemoteViews
inlinePresentation
InlinePresentation
inlineTooltipPresentation
InlinePresentation

傳回

屬性

備註

此方法在 API 等級 33 中被棄用。 改用 setAuthentication(AutofillId[],IntentSender,Presentations)。

在自動填滿這個回應中的任何資料集前,會觸發自訂介面。

這個方法類似 setAuthentication(AutofillId[],IntentSender,RemoteViews,InlinePresentation),但允許為內嵌建議工具提示設定 InlinePresentation。

Android 參考資料。android.service.autofill.FillResponse.Builder.setAuthentication

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於