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

# Builder

*** ** * ** ***

```
class Builder
```

|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||
| ↳ | [android.app.appfunctions.ExecuteAppFunctionRequest.Builder](https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest.Builder#) |

Builder for `https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest`.

## Summary

| Public constructors ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest.Builder#Builder(android.app.appfunctions.AppFunctionName)(appFunctionName: https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionName)` Constructs a `https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest.Builder#`. |
| `https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest.Builder#Builder(kotlin.String,%20kotlin.String)(targetPackageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, functionIdentifier: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Constructs a `https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest.Builder#`. |

| Public methods ||
|---|---|
| [ExecuteAppFunctionRequest](https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest) | `https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest.Builder#build()()` Builds the `https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest`. |
| [ExecuteAppFunctionRequest.Builder](https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest.Builder#) | `https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest.Builder#setActivityId(android.app.appfunctions.AppFunctionActivityId)(activityId: https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionActivityId?)` Sets the `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionActivityId`. |
| [ExecuteAppFunctionRequest.Builder](https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest.Builder#) | `https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest.Builder#setAttribution(android.app.AppInteractionAttribution)(attribution: https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution.html#)` Sets the `https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution.html#`. |
| [ExecuteAppFunctionRequest.Builder](https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest.Builder#) | `https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest.Builder#setExtras(android.os.Bundle)(extras: https://developer.android.com/reference/kotlin/android/os/Bundle.html#)` Sets the additional metadata for this function execution request. |
| [ExecuteAppFunctionRequest.Builder](https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest.Builder#) | `https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest.Builder#setParameters(android.app.appsearch.GenericDocument)(parameters: https://developer.android.com/reference/kotlin/android/app/appsearch/GenericDocument.html#)` Sets the function parameters as a key-value `https://developer.android.com/reference/kotlin/android/app/appsearch/GenericDocument.html#`. |

## Public constructors

### Builder

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

```
Builder(appFunctionName: AppFunctionName)
```

Constructs a `https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest.Builder#`.

| Parameters ||
|---|---|
| `appFunctionName` | [AppFunctionName](https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionName): The `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionName` of the target app function. See `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionMetadata#getName()` for how to determine this value. This value cannot be `null`. |

### Builder

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

```
Builder(
    targetPackageName: String, 
    functionIdentifier: String)
```

Constructs a `https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest.Builder#`.

| Parameters ||
|---|---|
| `targetPackageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The package name of the app that hosts the app function. See `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionMetadata#getName()` for how to determine this value. This value cannot be `null`. |
| `functionIdentifier` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The unique identifier for the app function to be executed. See `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionMetadata#getName()` for how to determine this value. This value cannot be `null`. |

## Public methods

### build

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

```
fun build(): ExecuteAppFunctionRequest
```

Builds the `https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest`.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest` | This value cannot be `null`. |

### setActivityId

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

```
fun setActivityId(activityId: AppFunctionActivityId?): ExecuteAppFunctionRequest.Builder
```

Sets the `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionActivityId`.

If the target app function's `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionMetadata#getScope()` is `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionMetadata#SCOPE_ACTIVITY:kotlin.Int`, this must be set to disambiguate between instances of the same app function running in different activities.

The value must be unset or null if the target app function is not `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionMetadata#SCOPE_ACTIVITY:kotlin.Int`.

The list of valid activity identifiers for a given function name can be obtained by calling `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionManager#getAppFunctionStates(kotlin.collections.MutableList,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver)`. The returned `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionState` objects will contain the associated activity IDs via `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionState#getActivityIds()`.

The list of functions provided by an activity can be obtained by calling `https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionManager#getAppFunctionActivityStates(kotlin.collections.MutableSet,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver)`.

| Parameters ||
|---|---|
| `activityId` | [AppFunctionActivityId](https://developer.android.com/reference/kotlin/android/app/appfunctions/AppFunctionActivityId)?: The activity identifier to associate with this request. This value may be `null`. |

### setAttribution

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

```
fun setAttribution(attribution: AppInteractionAttribution): ExecuteAppFunctionRequest.Builder
```

Sets the `https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution.html#`.

This information can be used by the privacy setting to provide transparency to the user about why an app function was invoked.

This is currently optional, but may become required for apps targeting a future release.

| Parameters ||
|---|---|
| `attribution` | [AppInteractionAttribution](https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution.html#): The attribution for this request. This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest.Builder#` | This value cannot be `null`. |

### setExtras

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

```
fun setExtras(extras: Bundle): ExecuteAppFunctionRequest.Builder
```

Sets the additional metadata for this function execution request.

| Parameters ||
|---|---|
| `extras` | [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#): The additional metadata for this function execution request. This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest.Builder#` | This value cannot be `null`. |

### setParameters

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

```
fun setParameters(parameters: GenericDocument): ExecuteAppFunctionRequest.Builder
```

Sets the function parameters as a key-value `https://developer.android.com/reference/kotlin/android/app/appsearch/GenericDocument.html#`.

| Parameters ||
|---|---|
| `parameters` | [GenericDocument](https://developer.android.com/reference/kotlin/android/app/appsearch/GenericDocument.html#): The parameters for this function execution request. This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/appfunctions/ExecuteAppFunctionRequest.Builder#` | This value cannot be `null`. |