Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

# AppFunction

*** ** * ** ***


`
public


interface
AppFunction
`


`


`

|---|
| android.app.appfunctions.AppFunction |

<br />

*** ** * ** ***

An interface for implementing the logic of an app function registered at runtime using `https://developer.android.com/reference/android/app/appfunctions/AppFunctionManager#registerAppFunction(java.lang.String,%20java.util.concurrent.Executor,%20android.app.appfunctions.AppFunction)`.

## Summary

| ### Public methods ||
|---|---|
| ` abstract void` | ` https://developer.android.com/reference/android/app/appfunctions/AppFunction#onExecuteAppFunction(android.app.appfunctions.ExecuteAppFunctionRequest,%20android.os.CancellationSignal,%20android.os.OutcomeReceiver<android.app.appfunctions.ExecuteAppFunctionResponse,android.app.appfunctions.AppFunctionException>)(https://developer.android.com/reference/android/app/appfunctions/ExecuteAppFunctionRequest request, https://developer.android.com/reference/android/os/CancellationSignal cancellationSignal, https://developer.android.com/reference/android/os/OutcomeReceiver<https://developer.android.com/reference/android/app/appfunctions/ExecuteAppFunctionResponse, https://developer.android.com/reference/android/app/appfunctions/AppFunctionException> callback) ` Called when the app function is invoked using `https://developer.android.com/reference/android/app/appfunctions/AppFunctionManager#executeAppFunction(android.app.AppInteractionSession,%20android.app.appfunctions.ExecuteAppFunctionRequest,%20java.util.concurrent.Executor,%20android.os.CancellationSignal,%20android.os.OutcomeReceiver<android.app.appfunctions.ExecuteAppFunctionResponse,android.app.appfunctions.AppFunctionException>)`. |

## Public methods

### onExecuteAppFunction

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void onExecuteAppFunction (ExecuteAppFunctionRequest request, 
                CancellationSignal cancellationSignal, 
                OutcomeReceiver<ExecuteAppFunctionResponse, AppFunctionException> callback)
```

Called when the app function is invoked using `https://developer.android.com/reference/android/app/appfunctions/AppFunctionManager#executeAppFunction(android.app.AppInteractionSession,%20android.app.appfunctions.ExecuteAppFunctionRequest,%20java.util.concurrent.Executor,%20android.os.CancellationSignal,%20android.os.OutcomeReceiver<android.app.appfunctions.ExecuteAppFunctionResponse,android.app.appfunctions.AppFunctionException>)`.

The implementation should try to respect the provided `https://developer.android.com/reference/android/os/CancellationSignal`, if
possible.

<br />

| Parameters ||
|---|---|
| `request` | `ExecuteAppFunctionRequest`: The `https://developer.android.com/reference/android/app/appfunctions/ExecuteAppFunctionRequest` containing the parameters for this execution. This value cannot be `null`. <br /> |
| `cancellationSignal` | `CancellationSignal`: A signal to cancel the execution. This value cannot be `null`. <br /> |
| `callback` | `OutcomeReceiver`: The `https://developer.android.com/reference/android/os/OutcomeReceiver` that the implementation must use to return the result of the execution. It must be called exactly once with either a successful `https://developer.android.com/reference/android/app/appfunctions/ExecuteAppFunctionResponse` or an `https://developer.android.com/reference/android/app/appfunctions/AppFunctionException` in case of an error. This value cannot be `null`. <br /> |