CallbackAppFunction


@ExperimentalAppFunctionsApi
fun interface CallbackAppFunction


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

Summary

Public functions

Unit
onExecuteAppFunction(
    request: ExecuteAppFunctionRequest,
    cancellationSignal: CancellationSignal,
    callback: Consumer<ExecuteAppFunctionResponse>
)

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

Public functions

onExecuteAppFunction

Added in 1.0.0-alpha12
fun onExecuteAppFunction(
    request: ExecuteAppFunctionRequest,
    cancellationSignal: CancellationSignal,
    callback: Consumer<ExecuteAppFunctionResponse>
): Unit

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

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

Parameters
request: ExecuteAppFunctionRequest

The ExecuteAppFunctionRequest containing the parameters for this execution.

cancellationSignal: CancellationSignal

A signal to cancel the execution.

callback: Consumer<ExecuteAppFunctionResponse>

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.