Added in API level 26

FillCallback


class FillCallback
kotlin.Any
   ↳ android.service.autofill.FillCallback

FillCallback handles autofill requests from the AutofillService into the Activity being autofilled.

To learn about using Autofill services in your app, read Build autofill services.

Summary

Public methods
Unit

Notifies the Android System that a fill request ( AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal,) could not be fulfilled by the service (for example, because the user data was not available yet), so the request could be retried later.

Unit
onSuccess(response: FillResponse?)

Notifies the Android System that a fill request (AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal,) was successfully fulfilled by the service.

Public methods

onFailure

Added in API level 26
fun onFailure(message: CharSequence?): Unit

Notifies the Android System that a fill request ( AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal,) could not be fulfilled by the service (for example, because the user data was not available yet), so the request could be retried later.

Note: this method should not be used when the service didn't have the heursitics to fulfill the request; in this case, the service should call onSuccess(null) instead.

Note: prior to android.os.Build.VERSION_CODES#Q, this method was not working as intended and the service should always call onSuccess(null) instead.

Note: for apps targeting android.os.Build.VERSION_CODES#Q or higher, this method just logs the message on logcat; for apps targetting older SDKs, it also displays the message to user using a android.widget.Toast. Generally speaking, you should not display an error to the user if the request failed, unless the request had the FillRequest#FLAG_MANUAL_REQUEST flag.

Parameters
message CharSequence?: error message. Note: this message should not contain PII (Personally Identifiable Information, such as username or email address). This value may be null.
Exceptions
java.lang.IllegalStateException if this method or onSuccess(android.service.autofill.FillResponse) was already called.

onSuccess

Added in API level 26
fun onSuccess(response: FillResponse?): Unit

Notifies the Android System that a fill request (AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal,) was successfully fulfilled by the service.

This method should always be called, even if the service doesn't have the heuristics to fulfill the request (in which case it should be called with null).

See the main AutofillService documentation for more details and examples.

Parameters
response FillResponse?: autofill information for that activity, or null when the service cannot autofill the activity.
Exceptions
java.lang.IllegalStateException if this method or onFailure(java.lang.CharSequence) was already called.