# TrustedWebActivityIntentBuilder

Artifact: [androidx.browser:browser](https://developer.android.com/jetpack/androidx/releases/browser) [View Source](https://cs.android.com/search?q=file:androidx/browser/trusted/TrustedWebActivityIntentBuilder.java+class:androidx.browser.trusted.TrustedWebActivityIntentBuilder) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

*** ** * ** ***


```
public class TrustedWebActivityIntentBuilder
```

<br />

*** ** * ** ***

Constructs instances of `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntent` that can be used to start Trusted Web Activities (see `https://developer.android.com/reference/androidx/browser/customtabs/TrustedWebUtils` for more details).

## Summary

| ### Constants |
|---|---|
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#EXTRA_ADDITIONAL_TRUSTED_ORIGINS() = "android.support.customtabs.extra.ADDITIONAL_TRUSTED_ORIGINS"` Extra for the Trusted Web Activity launch Intent to specify a list of origins for the browser to treat as trusted, in addition to the origin of the launching URL. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#EXTRA_DISPLAY_MODE() = "androidx.browser.trusted.extra.DISPLAY_MODE"` Extra for the `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityDisplayMode`, see `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setDisplayMode(androidx.browser.trusted.TrustedWebActivityDisplayMode)`. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#EXTRA_DISPLAY_OVERRIDE() = "androidx.browser.trusted.extra.DISPLAY_OVERRIDE"` Extra for the display override list, see `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setDisplayOverrideList(java.util.List<androidx.browser.trusted.TrustedWebActivityDisplayMode>)` |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#EXTRA_FILE_HANDLING_DATA() = "androidx.browser.trusted.extra.FILE_HANDLING_DATA"` Extra for the opened files data, see setHandledFiles. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#EXTRA_LAUNCH_HANDLER_CLIENT_MODE() = "androidx.browser.trusted.extra.LAUNCH_HANDLER_CLIENT_MODE"` If a TWA is being launched using Launch Handler API, its client mode value is provided, see `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setLaunchHandlerClientMode(int)`. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#EXTRA_ORIGINAL_LAUNCH_URL() = "androidx.browser.trusted.extra.ORIGINAL_LAUNCH_URL"` If the TWA is being launched using a Protocol Handler, the original URL (with the custom scheme) is provided here, set using `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setOriginalLaunchUrl(android.net.Uri)`. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#EXTRA_SCREEN_ORIENTATION() = "androidx.browser.trusted.extra.SCREEN_ORIENTATION"` Extra for the screenOrientation, see `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setScreenOrientation(int)`. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#EXTRA_SHARE_DATA() = "androidx.browser.trusted.extra.SHARE_DATA"` Extra for the share data, see `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setShareParams(androidx.browser.trusted.sharing.ShareTarget,androidx.browser.trusted.sharing.ShareData)`. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#EXTRA_SHARE_TARGET() = "androidx.browser.trusted.extra.SHARE_TARGET"` Extra for the share target, see `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setShareParams(androidx.browser.trusted.sharing.ShareTarget,androidx.browser.trusted.sharing.ShareData)`. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#EXTRA_SPLASH_SCREEN_PARAMS() = "androidx.browser.trusted.EXTRA_SPLASH_SCREEN_PARAMS"` Extra for the Trusted Web Activity launch Intent to specify a `https://developer.android.com/reference/android/os/Bundle.html` of parameters for the browser to use in constructing a splash screen. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#TrustedWebActivityIntentBuilder(android.net.Uri)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/net/Uri.html uri)` Creates a Builder given the required parameters. |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntent` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#build(androidx.browser.customtabs.CustomTabsSession)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession session)` Builds an instance of `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntent`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#buildCustomTabsIntent()()` Builds a `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent` based on provided parameters. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityDisplayMode` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#getDisplayMode()()` Returns `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityDisplayMode` set on this Builder. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/net/Uri.html` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#getUri()()` Returns the `https://developer.android.com/reference/android/net/Uri.html` to be launched with this Builder. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setAdditionalTrustedOrigins(java.util.List<java.lang.String>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html> origins)` Sets a list of additional trusted origins that the user may navigate or be redirected to from the starting uri. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setColorScheme(int)(int colorScheme)` Sets the color scheme, see `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setColorScheme(int)`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setColorSchemeParams(int,androidx.browser.customtabs.CustomTabColorSchemeParams)( int colorScheme, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/customtabs/CustomTabColorSchemeParams params )` Sets `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabColorSchemeParams` for the given color scheme. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setDefaultColorSchemeParams(androidx.browser.customtabs.CustomTabColorSchemeParams)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/customtabs/CustomTabColorSchemeParams params)` Sets the default `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabColorSchemeParams`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setDisplayMode(androidx.browser.trusted.TrustedWebActivityDisplayMode)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityDisplayMode displayMode)` Sets a `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityDisplayMode`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setDisplayOverrideList(java.util.List<androidx.browser.trusted.TrustedWebActivityDisplayMode>)( @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityDisplayMode> displayOverrideList )` Sets the display override fallback list for a Trusted Web Activity. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setFileHandlingData(androidx.browser.trusted.FileHandlingData)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/FileHandlingData fileHandlingData)` Sets the parameters for delivering launch files to the launch queue. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setLaunchHandlerClientMode(int)(int launchHandlerClientMode)` Sets the parameter for delivering Launch Handler API client mode via a Trusted Web Activity. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder` | `[setNavigationBarColor](https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setNavigationBarColor(int))(@https://developer.android.com/reference/androidx/annotation/ColorInt int color)` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setDefaultColorSchemeParams(androidx.browser.customtabs.CustomTabColorSchemeParams)` instead. <br /> |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder` | `[setNavigationBarDividerColor](https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setNavigationBarDividerColor(int))(@https://developer.android.com/reference/androidx/annotation/ColorInt int color)` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setDefaultColorSchemeParams(androidx.browser.customtabs.CustomTabColorSchemeParams)` instead. <br /> |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setOriginalLaunchUrl(android.net.Uri)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/net/Uri.html originalLaunchUrl)` Sets the original launch URL. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setScreenOrientation(int)(int orientation)` Sets a screenOrientation. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setShareParams(androidx.browser.trusted.sharing.ShareTarget,androidx.browser.trusted.sharing.ShareData)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareTarget shareTarget, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData shareData )` Sets the parameters for delivering data to a Web Share Target via a Trusted Web Activity. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder` | `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setSplashScreenParams(android.os.Bundle)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html splashScreenParams)` Sets the parameters of a splash screen shown while the web page is loading, such as background color. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder` | `[setToolbarColor](https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setToolbarColor(int))(@https://developer.android.com/reference/androidx/annotation/ColorInt int color)` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setDefaultColorSchemeParams(androidx.browser.customtabs.CustomTabColorSchemeParams)` instead. <br /> |

## Constants

### EXTRA_ADDITIONAL_TRUSTED_ORIGINS

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public static final String EXTRA_ADDITIONAL_TRUSTED_ORIGINS = "android.support.customtabs.extra.ADDITIONAL_TRUSTED_ORIGINS"
```

Extra for the Trusted Web Activity launch Intent to specify a list of origins for the browser to treat as trusted, in addition to the origin of the launching URL. It is recommended to use `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder` instead of manually piecing the Intent together.

### EXTRA_DISPLAY_MODE

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public static final String EXTRA_DISPLAY_MODE = "androidx.browser.trusted.extra.DISPLAY_MODE"
```

Extra for the `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityDisplayMode`, see `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setDisplayMode(androidx.browser.trusted.TrustedWebActivityDisplayMode)`.

### EXTRA_DISPLAY_OVERRIDE

Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/browser#1.10.0)

```
public static final String EXTRA_DISPLAY_OVERRIDE = "androidx.browser.trusted.extra.DISPLAY_OVERRIDE"
```

Extra for the display override list, see `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setDisplayOverrideList(java.util.List<androidx.browser.trusted.TrustedWebActivityDisplayMode>)`

### EXTRA_FILE_HANDLING_DATA

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/browser#1.9.0)

```
public static final String EXTRA_FILE_HANDLING_DATA = "androidx.browser.trusted.extra.FILE_HANDLING_DATA"
```

Extra for the opened files data, see setHandledFiles.

### EXTRA_LAUNCH_HANDLER_CLIENT_MODE

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/browser#1.9.0)

```
public static final String EXTRA_LAUNCH_HANDLER_CLIENT_MODE = "androidx.browser.trusted.extra.LAUNCH_HANDLER_CLIENT_MODE"
```

If a TWA is being launched using Launch Handler API, its client mode value is provided, see `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setLaunchHandlerClientMode(int)`.

### EXTRA_ORIGINAL_LAUNCH_URL

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/browser#1.9.0)

```
public static final String EXTRA_ORIGINAL_LAUNCH_URL = "androidx.browser.trusted.extra.ORIGINAL_LAUNCH_URL"
```

If the TWA is being launched using a Protocol Handler, the original URL (with the custom scheme) is provided here, set using `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setOriginalLaunchUrl(android.net.Uri)`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntent#getOriginalLaunchUrl()` |   |

### EXTRA_SCREEN_ORIENTATION

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/browser#1.3.0)

```
public static final String EXTRA_SCREEN_ORIENTATION = "androidx.browser.trusted.extra.SCREEN_ORIENTATION"
```

Extra for the screenOrientation, see `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setScreenOrientation(int)`.

### EXTRA_SHARE_DATA

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public static final String EXTRA_SHARE_DATA = "androidx.browser.trusted.extra.SHARE_DATA"
```

Extra for the share data, see `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setShareParams(androidx.browser.trusted.sharing.ShareTarget,androidx.browser.trusted.sharing.ShareData)`.

### EXTRA_SHARE_TARGET

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public static final String EXTRA_SHARE_TARGET = "androidx.browser.trusted.extra.SHARE_TARGET"
```

Extra for the share target, see `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setShareParams(androidx.browser.trusted.sharing.ShareTarget,androidx.browser.trusted.sharing.ShareData)`.

### EXTRA_SPLASH_SCREEN_PARAMS

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public static final String EXTRA_SPLASH_SCREEN_PARAMS = "androidx.browser.trusted.EXTRA_SPLASH_SCREEN_PARAMS"
```

Extra for the Trusted Web Activity launch Intent to specify a `https://developer.android.com/reference/android/os/Bundle.html` of parameters for the browser to use in constructing a splash screen. It is recommended to use `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder` instead of manually piecing the Intent together.

## Public constructors

### TrustedWebActivityIntentBuilder

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public TrustedWebActivityIntentBuilder(@NonNull Uri uri)
```

Creates a Builder given the required parameters.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/net/Uri.html uri` | The web page to launch as Trusted Web Activity. |

## Public methods

### build

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public @NonNull TrustedWebActivityIntent build(@NonNull CustomTabsSession session)
```

Builds an instance of `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntent`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession session` | The `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession` to use for launching a Trusted Web Activity. |

### buildCustomTabsIntent

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public @NonNull CustomTabsIntent buildCustomTabsIntent()
```

Builds a `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent` based on provided parameters. Can be useful for falling back to Custom Tabs when Trusted Web Activity providers are unavailable.

### getDisplayMode

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public @NonNull TrustedWebActivityDisplayMode getDisplayMode()
```

Returns `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityDisplayMode` set on this Builder.

### getUri

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public @NonNull Uri getUri()
```

Returns the `https://developer.android.com/reference/android/net/Uri.html` to be launched with this Builder.

### setAdditionalTrustedOrigins

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public @NonNull TrustedWebActivityIntentBuilder setAdditionalTrustedOrigins(@NonNull List<String> origins)
```

Sets a list of additional trusted origins that the user may navigate or be redirected to from the starting uri. For example, if the user starts at https://www.example.com/page1 and is redirected to https://m.example.com/page2, and both origins are associated with the calling application via the Digital Asset Links, then pass "https://www.example.com/page1" as uri and Arrays.asList("https://m.example.com") as additionalTrustedOrigins. Alternatively, use `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#validateRelationship(int,android.net.Uri,android.os.Bundle)` to validate additional origins asynchronously, but that would delay launching the Trusted Web Activity.

### setColorScheme

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public @NonNull TrustedWebActivityIntentBuilder setColorScheme(int colorScheme)
```

Sets the color scheme, see `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setColorScheme(int)`. In Trusted Web Activities color scheme may affect such UI elements as info bars and context menus.

| Parameters |
|---|---|
| `int colorScheme` | Must be one of `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent#COLOR_SCHEME_SYSTEM()`, `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent#COLOR_SCHEME_LIGHT()`, and `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent#COLOR_SCHEME_DARK()`. |

### setColorSchemeParams

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public @NonNull TrustedWebActivityIntentBuilder setColorSchemeParams(
    int colorScheme,
    @NonNull CustomTabColorSchemeParams params
)
```

Sets `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabColorSchemeParams` for the given color scheme. This allows, for example, to set two navigation bar colors - for light and dark scheme. Trusted Web Activity will automatically apply the correct color according to current system settings. For more details see `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setColorSchemeParams(int,androidx.browser.customtabs.CustomTabColorSchemeParams)`.

### setDefaultColorSchemeParams

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/browser#1.3.0)

```
public @NonNull TrustedWebActivityIntentBuilder setDefaultColorSchemeParams(@NonNull CustomTabColorSchemeParams params)
```

Sets the default `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabColorSchemeParams`. This will set a default color scheme that applies when no CustomTabColorSchemeParams specified for current color scheme via `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setColorSchemeParams(int,androidx.browser.customtabs.CustomTabColorSchemeParams)`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/customtabs/CustomTabColorSchemeParams params` | An instance of `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabColorSchemeParams`. |

### setDisplayMode

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public @NonNull TrustedWebActivityIntentBuilder setDisplayMode(@NonNull TrustedWebActivityDisplayMode displayMode)
```

Sets a `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityDisplayMode`. This can be used e.g. to enable immersive mode (see `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityDisplayMode.ImmersiveMode`. Not setting it means `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityDisplayMode.DefaultMode` will be used.

### setDisplayOverrideList

Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/browser#1.10.0)

```
public @NonNull TrustedWebActivityIntentBuilder setDisplayOverrideList(
    @Nullable List<TrustedWebActivityDisplayMode> displayOverrideList
)
```

Sets the display override fallback list for a Trusted Web Activity. Web applications can declare a "display_override" list to specify the preferred order of display modes. This is useful for more advanced display modes that may have limited browser support ({@see https://wicg.github.io/manifest-incubations/#display_override-member}). The browser will use the first display mode in the list that it supports, and fall back to the \`display\` manifest field if none are supported.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityDisplayMode> displayOverrideList` | A list of `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityDisplayMode` that represents the fallback order of display modes. |

### setFileHandlingData

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/browser#1.9.0)

```
public @NonNull TrustedWebActivityIntentBuilder setFileHandlingData(@NonNull FileHandlingData fileHandlingData)
```

Sets the parameters for delivering launch files to the launch queue. A web application can declare "file_handlers" in its web manifest, enabling it to handle file opening requests from users. The opened files are then made available by the browser to the web app through the LaunchQueue interface of the Launch Handler API. LaunchQueue implementation depends on a browser receiving a TrustedWebActivityIntent. This method provides the support for file handling in Trusted Web Activities. `https://developer.android.com/reference/androidx/browser/trusted/FileHandlingData` should contain the URIs list of files opened by a user and captured by an intent filter declared in the app manifest. API doesn't perform URI validation and it entirely dependents on a browser receiving a TrustedWebActivityIntent. The API passes read/write permissions for the files to the browser to allow the web application to read and write a file as it required by LaunchQueue interface specification.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/FileHandlingData fileHandlingData` | A `https://developer.android.com/reference/androidx/browser/trusted/FileHandlingData` object containing the data to be sent to browser launch queue. |

### setLaunchHandlerClientMode

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/browser#1.9.0)

```
public @NonNull TrustedWebActivityIntentBuilder setLaunchHandlerClientMode(int launchHandlerClientMode)
```

Sets the parameter for delivering Launch Handler API client mode via a Trusted Web Activity.

| Parameters |
|---|---|
| `int launchHandlerClientMode` | A string describing the client mode. |

### setNavigationBarColor

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0) Deprecated in [1.3.0](https://developer.android.com/jetpack/androidx/releases/browser#1.3.0)

```
public @NonNull TrustedWebActivityIntentBuilder [setNavigationBarColor](https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setNavigationBarColor(int))(@ColorInt int color)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setDefaultColorSchemeParams(androidx.browser.customtabs.CustomTabColorSchemeParams)` instead.

Sets the navigation bar color, see `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setNavigationBarColor(int)`.

### setNavigationBarDividerColor

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/browser#1.3.0) Deprecated in [1.3.0](https://developer.android.com/jetpack/androidx/releases/browser#1.3.0)

```
public @NonNull TrustedWebActivityIntentBuilder [setNavigationBarDividerColor](https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setNavigationBarDividerColor(int))(@ColorInt int color)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setDefaultColorSchemeParams(androidx.browser.customtabs.CustomTabColorSchemeParams)` instead.

Sets the navigation bar divider color, see `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setNavigationBarDividerColor(int)`.

### setOriginalLaunchUrl

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/browser#1.9.0)

```
public @NonNull TrustedWebActivityIntentBuilder setOriginalLaunchUrl(@NonNull Uri originalLaunchUrl)
```

Sets the original launch URL. This is used by Protocol Handlers to let the browser see the URL that was opened before being processed an modified (the original URL will usually have a custom data scheme and no host, as opposed to the full http/https location in the Intent data).

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/net/Uri.html originalLaunchUrl` | The URL that was originally opened, before being processed and modified by a Protocol Handler. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntent#getOriginalLaunchUrl()` |   |

### setScreenOrientation

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/browser#1.3.0)

```
public @NonNull TrustedWebActivityIntentBuilder setScreenOrientation(int orientation)
```

Sets a screenOrientation. This can be used e.g. to enable the locking of an orientation lock type `https://developer.android.com/reference/androidx/browser/trusted/ScreenOrientation`.

| Parameters |
|---|---|
| `int orientation` | A `https://developer.android.com/reference/androidx/browser/trusted/ScreenOrientation` lock type for a Trusted Web Activity. Not setting it means `https://developer.android.com/reference/androidx/browser/trusted/ScreenOrientation#DEFAULT()` will be used. |

### setShareParams

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public @NonNull TrustedWebActivityIntentBuilder setShareParams(
    @NonNull ShareTarget shareTarget,
    @NonNull ShareData shareData
)
```

Sets the parameters for delivering data to a Web Share Target via a Trusted Web Activity.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareTarget shareTarget` | A `https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareTarget` object describing the Web Share Target. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData shareData` | A `https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData` object containing the data to be sent to the Web Share Target. |

### setSplashScreenParams

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public @NonNull TrustedWebActivityIntentBuilder setSplashScreenParams(@NonNull Bundle splashScreenParams)
```

Sets the parameters of a splash screen shown while the web page is loading, such as background color. See `https://developer.android.com/reference/androidx/browser/trusted/splashscreens/SplashScreenParamKey` for a list of supported parameters. To provide the image for the splash screen, use `https://developer.android.com/reference/androidx/browser/customtabs/TrustedWebUtils#transferSplashImage(android.content.Context,java.io.File,java.lang.String,java.lang.String,androidx.browser.customtabs.CustomTabsSession)`, prior to launching the intent. It is recommended to also show the same splash screen in the app as soon as possible, prior to establishing a CustomTabConnection. The Trusted Web Activity provider should ensure seamless transition of the splash screen from the app onto the top of webpage being loaded. The splash screen will be removed on the first paint of the page, or when the page load fails.

### setToolbarColor

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0) Deprecated in [1.3.0](https://developer.android.com/jetpack/androidx/releases/browser#1.3.0)

```
public @NonNull TrustedWebActivityIntentBuilder [setToolbarColor](https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setToolbarColor(int))(@ColorInt int color)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setDefaultColorSchemeParams(androidx.browser.customtabs.CustomTabColorSchemeParams)` instead.

Sets the color applied to the toolbar and the status bar, see `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setToolbarColor(int)`. When a Trusted Web Activity is on the verified origin, the toolbar is hidden, so the color applies only to the status bar. When it's on an unverified origin, the toolbar is shown, and the color applies to both toolbar and status bar.