Added in [API level 37](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.AppInteractionAttribution.Builder](https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution.Builder#) |

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

## Summary

| Public constructors ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution.Builder#Builder(kotlin.Int)(interactionType: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Creates a new instance of this builder class. |

| Public methods ||
|---|---|
| [AppInteractionAttribution](https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution) | `https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution.Builder#build()()` Builds the `https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution`. |
| [AppInteractionAttribution.Builder](https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution.Builder#) | `https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution.Builder#setCustomInteractionType(kotlin.String)(customInteractionType: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Sets the custom interaction type to describe the interaction. |
| [AppInteractionAttribution.Builder](https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution.Builder#) | `https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution.Builder#setInteractionUri(android.net.Uri)(interactionUri: https://developer.android.com/reference/kotlin/android/net/Uri.html#?)` Sets a deeplink `https://developer.android.com/reference/kotlin/android/net/Uri.html#` to the user request that initiated the interaction. |

## Public constructors

### Builder

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

```
Builder(interactionType: Int)
```

Creates a new instance of this builder class.

| Parameters ||
|---|---|
| `interactionType` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The interaction type. Must be one of `https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution#INTERACTION_TYPE_OTHER:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution#INTERACTION_TYPE_USER_QUERY:kotlin.Int`, or `https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution#INTERACTION_TYPE_USER_SCHEDULED:kotlin.Int`. If `https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution#INTERACTION_TYPE_OTHER:kotlin.Int` is used, `https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution.Builder#setCustomInteractionType(kotlin.String)` must also be called. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution#INTERACTION_TYPE_OTHER:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution#INTERACTION_TYPE_USER_QUERY:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution#INTERACTION_TYPE_USER_SCHEDULED:kotlin.Int` |

## Public methods

### build

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

```
fun build(): AppInteractionAttribution
```

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

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

### setCustomInteractionType

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

```
fun setCustomInteractionType(customInteractionType: String): AppInteractionAttribution.Builder
```

Sets the custom interaction type to describe the interaction.

This method must be called if and only if the `interactionType` provided to the constructor was `https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution#INTERACTION_TYPE_OTHER:kotlin.Int`. The caller should define a set of string constants for these custom interaction types and set them here accordingly.

| Parameters ||
|---|---|
| `customInteractionType` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): This value cannot be `null`. |

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

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | If the interaction type is not `https://developer.android.com/reference/kotlin/android/app/AppInteractionAttribution#INTERACTION_TYPE_OTHER:kotlin.Int`. |

### setInteractionUri

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

```
fun setInteractionUri(interactionUri: Uri?): AppInteractionAttribution.Builder
```

Sets a deeplink `https://developer.android.com/reference/kotlin/android/net/Uri.html#` to the user request that initiated the interaction.

When set, this URI can be used by privacy settings to display a link in the audit history, allowing users to navigate to the context of the original interaction.

For the link to be functional, the provided `https://developer.android.com/reference/kotlin/android/net/Uri.html#` **must** be resolvable by an `https://developer.android.com/reference/kotlin/android/content/Intent.html#` with the action `https://developer.android.com/reference/kotlin/android/content/Intent.html#ACTION_VIEW:kotlin.String`. To allow privacy settings to launch your activity, the target `https://developer.android.com/reference/kotlin/android/app/Activity` **must** declare a corresponding `<intent-filter>` in your manifest.

| Parameters ||
|---|---|
| `interactionUri` | [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)?: This value may be `null`. |

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