AppSearchOptions.Builder

  • The AppSearchOptions.Builder class is used to construct instances of AppSearchOptions.

  • You can build the configured object using the build() method.

  • The setWorkerExecutor() method allows you to specify an Executor for dispatching listener events and callbacks, overriding the default main thread usage.

  • The specified Executor for setWorkerExecutor is only effective on Android P (API Level 29) and above.

public static class AppSearchOptions.Builder extends Object

Builder to construct instances of AppSearchOptions.

Public Constructor Summary

Public Method Summary

AppSearchOptions
build()
Build the configured object.
AppSearchOptions.Builder
setWorkerExecutor(Executor workerExecutor)
Sets a workerExecutor used to dispatch listener events and callbacks for ServiceConnection, otherwise the main thread is used by default.

Inherited Method Summary

Public Constructors

public Builder ()

Public Methods

public AppSearchOptions build ()

Build the configured object.

public AppSearchOptions.Builder setWorkerExecutor (Executor workerExecutor)

Sets a workerExecutor used to dispatch listener events and callbacks for ServiceConnection, otherwise the main thread is used by default. We use the same Executor for Task.addOnCompleteListener(Activity, OnCompleteListener) for all APIs.

NOTE: The Executor is only effective for Android P (API Level 29) and above. Pre-P devices will deadlock if they attempt to make blocking AppSearch API calls from the main thread as the same thread is used by default for connection callbacks.

Returns
  • the same Builder instance.