close
The Wayback Machine - https://web.archive.org/web/20170709231906/https://developer.android.com/reference/android/service/autofill/AutofillService.html
Skip to content

Most visited

Recently visited

navigation

AutofillService

public abstract class AutofillService
extends Service

java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.app.Service
         ↳ android.service.autofill.AutofillService


Top-level service of the current autofill service for a given user.

Apps providing autofill capabilities must extend this service.

Summary

Constants

String SERVICE_INTERFACE

The Intent that must be declared as handled by the service.

String SERVICE_META_DATA

Name under which a AutoFillService component publishes information about itself.

Inherited constants

BERJAYA From class android.app.Service
BERJAYA From class android.content.Context
BERJAYA From interface android.content.ComponentCallbacks2

Public constructors

AutofillService()

Public methods

final FillEventHistory getFillEventHistory()

Returns the events since the last FillResponse was returned.

final IBinder onBind(Intent intent)

Return the communication channel to the service.

void onConnected()

Called when the Android system connects to service.

void onCreate()

Called by the system when the service is first created. NOTE: if overridden, it must call super.onCreate().

void onDisconnected()

Called when the Android system disconnects from the service.

abstract void onFillRequest(FillRequest request, CancellationSignal cancellationSignal, FillCallback callback)

Called by the Android system do decide if an Activity can be autofilled by the service.

abstract void onSaveRequest(SaveRequest request, SaveCallback callback)

Called when user requests service to save the fields of an Activity.

Inherited methods

BERJAYA From class android.app.Service
BERJAYA From class android.content.ContextWrapper
BERJAYA From class android.content.Context
BERJAYA From class java.lang.Object
BERJAYA From interface android.content.ComponentCallbacks2
BERJAYA From interface android.content.ComponentCallbacks

Constants

SERVICE_INTERFACE

String SERVICE_INTERFACE

The Intent that must be declared as handled by the service. To be supported, the service must also require the BIND_AUTOFILL_SERVICE permission so that other applications can not abuse it.

Constant Value: "android.service.autofill.AutofillService"

SERVICE_META_DATA

String SERVICE_META_DATA

Name under which a AutoFillService component publishes information about itself. This meta-data should reference an XML resource containing a <autofill-service> tag. This is a a sample XML file configuring an AutoFillService:

 <autofill-service
     android:settingsActivity="foo.bar.SettingsActivity"
     . . .
 />

Constant Value: "android.autofill"

Public constructors

AutofillService

AutofillService ()

Public methods

getFillEventHistory

FillEventHistory getFillEventHistory ()

Returns the events since the last FillResponse was returned.

The history is not persisted over reboots.

Returns
FillEventHistory The history or null if there are not events.

This value may be null.

onBind

IBinder onBind (Intent intent)

Return the communication channel to the service. May return null if clients can not bind to the service. The returned IBinder is usually for a complex interface that has been described using aidl.

Note that unlike other application components, calls on to the IBinder interface returned here may not happen on the main thread of the process. More information about the main thread can be found in Processes and Threads.

Parameters
intent Intent: The Intent that was used to bind to this service, as given to Context.bindService. Note that any extras that were included with the Intent at that point will not be seen here.

Returns
IBinder Return an IBinder through which clients can call on to the service.

onConnected

void onConnected ()

Called when the Android system connects to service.

You should generally do initialization here rather than in onCreate().

onCreate

void onCreate ()

Called by the system when the service is first created. Do not call this method directly. NOTE: if overridden, it must call super.onCreate().

If you override this method you must call through to the superclass implementation.

onDisconnected

void onDisconnected ()

Called when the Android system disconnects from the service.

At this point this service may no longer be an active AutofillService.

onFillRequest

void onFillRequest (FillRequest request, 
                CancellationSignal cancellationSignal, 
                FillCallback callback)

Called by the Android system do decide if an Activity can be autofilled by the service.

Service must call one of the FillCallback methods (like onSuccess(FillResponse) or onFailure(CharSequence)) to notify the result of the request.

Parameters
request FillRequest: the request to handle. See FillResponse for examples of multiple-sections requests.

This value must never be null.

cancellationSignal CancellationSignal: signal for observing cancellation requests. The system will use this to notify you that the fill result is no longer needed and you should stop handling this fill request in order to save resources.

This value must never be null.

callback FillCallback: object used to notify the result of the request.

This value must never be null.

onSaveRequest

void onSaveRequest (SaveRequest request, 
                SaveCallback callback)

Called when user requests service to save the fields of an Activity.

Service must call one of the SaveCallback methods (like onSuccess() or onFailure(CharSequence)) to notify the result of the request.

Parameters
request SaveRequest: the request to handle. See FillResponse for examples of multiple-sections requests.

This value must never be null.

callback SaveCallback: object used to notify the result of the request.

This value must never be null.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.