lightbulb_outline Please take our October 2018 developer survey. Start survey
added in API level 26

FillCallback

public final class FillCallback
extends Object

java.lang.Object
   ↳ 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

void onFailure(CharSequence message)

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

void onSuccess(FillResponse response)

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

Inherited methods

Public methods

onFailure

added in API level 26
public void onFailure (CharSequence message)

Notifies the Android System that a fill request ( AutofillService.onFillRequest(FillRequest, android.os.CancellationSignal, FillCallback)) 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: on Android versions up to Build.VERSION_CODES.P, this method is not working as intended, and the service should call onSuccess(null) instead.

Parameters
message CharSequence: error message to be displayed to the user. Note: this message is displayed on logcat logs and should not contain PII (Personally Identifiable Information, such as username or email address).

This value may be null.

Throws
IllegalStateException if this method or onSuccess(FillResponse) was already called.

onSuccess

added in API level 26
public void onSuccess (FillResponse response)

Notifies the Android System that a fill request (AutofillService.onFillRequest(FillRequest, android.os.CancellationSignal, FillCallback)) 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.

Throws
IllegalStateException if this method or onFailure(CharSequence) was already called.