CallbackAppFunction


@ExperimentalAppFunctionsApi
public fun interface CallbackAppFunction


An interface for implementing the logic of an app function registered at runtime using AppFunctionManager.registerAppFunction.

Summary

Public methods

abstract void

Called when the app function is invoked using AppFunctionManager.executeAppFunction.

Public methods

onExecuteAppFunction

Added in 1.0.0-alpha12
abstract void onExecuteAppFunction(
    @NonNull ExecuteAppFunctionRequest request,
    @NonNull CancellationSignal cancellationSignal,
    @NonNull Consumer<@NonNull ExecuteAppFunctionResponse> callback
)

Called when the app function is invoked using AppFunctionManager.executeAppFunction.

The implementation should try to respect the provided CancellationSignal, if possible.

Parameters
@NonNull ExecuteAppFunctionRequest request

The ExecuteAppFunctionRequest containing the parameters for this execution.

@NonNull CancellationSignal cancellationSignal

A signal to cancel the execution.

@NonNull Consumer<@NonNull ExecuteAppFunctionResponse> callback

The Consumer that the implementation must use to return the result of the execution. It must be called exactly once with either a successful ExecuteAppFunctionResponse.Success or ExecuteAppFunctionResponse.Error in case of an error.