# CustomTabsClient

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

*** ** * ** ***


```
class CustomTabsClient
```

<br />

*** ** * ** ***

Class to communicate with a `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsService` and create `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSession` from it.

## Summary

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession?` | `@https://developer.android.com/reference/kotlin/androidx/browser/customtabs/ExperimentalPendingSession https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#attachAuthTabSession(androidx.browser.auth.AuthTabSession.PendingSession)(session: https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession.PendingSession)` Associate `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession.PendingSession` with the service and turn it into an `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession`. |
| `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSession?` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#attachSession(androidx.browser.customtabs.CustomTabsSession.PendingSession)(session: https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSession.PendingSession)` Associate `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSession.PendingSession` with the service and turn it into a `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSession`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#bindCustomTabsService(android.content.Context,java.lang.String,androidx.browser.customtabs.CustomTabsServiceConnection)( context: https://developer.android.com/reference/android/content/Context.html, packageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, connection: https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsServiceConnection )` Bind to a `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsService` using the given package name and `https://developer.android.com/reference/android/content/ServiceConnection.html`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#bindCustomTabsServicePreservePriority(android.content.Context,java.lang.String,androidx.browser.customtabs.CustomTabsServiceConnection)( context: https://developer.android.com/reference/android/content/Context.html, packageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, connection: https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsServiceConnection )` Bind to a `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsService` using the given package name and `https://developer.android.com/reference/android/content/ServiceConnection.html`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#connectAndInitialize(android.content.Context,java.lang.String)(context: https://developer.android.com/reference/android/content/Context.html, packageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Connects to the Custom Tabs warmup service, and initializes the browser. |
| `java-static https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession.PendingSession` | `@https://developer.android.com/reference/kotlin/androidx/browser/customtabs/ExperimentalPendingSession https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#createPendingAuthTabSession(android.content.Context,int)(context: https://developer.android.com/reference/android/content/Context.html, id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Creates a new pending session without a callback. |
| `java-static https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession.PendingSession` | `@https://developer.android.com/reference/kotlin/androidx/browser/customtabs/ExperimentalPendingSession https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#createPendingAuthTabSession(android.content.Context,int,java.util.concurrent.Executor,androidx.browser.auth.AuthTabCallback)( context: https://developer.android.com/reference/android/content/Context.html, id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, executor: https://developer.android.com/reference/java/util/concurrent/Executor.html, callback: https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabCallback )` Creates a new pending session with a callback. |
| `https://developer.android.com/reference/android/os/Bundle.html?` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#extraCommand(java.lang.String,android.os.Bundle)(commandName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, args: https://developer.android.com/reference/android/os/Bundle.html?)` Can be used as a channel between the Custom Tabs client and the provider to do something that is not part of the API yet. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#getPackageName(android.content.Context,java.util.List<java.lang.String>)(context: https://developer.android.com/reference/android/content/Context.html, packages: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>?)` Returns the preferred package to use for Custom Tabs, preferring the default VIEW handler. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#getPackageName(android.content.Context,java.util.List<java.lang.String>,boolean)( context: https://developer.android.com/reference/android/content/Context.html, packages: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>?, ignoreDefault: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Returns the preferred package to use for Custom Tabs. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#isAuthTabSupported(android.content.Context,java.lang.String)(context: https://developer.android.com/reference/android/content/Context.html, provider: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Checks whether the Custom Tabs provider supports Auth Tab. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#isEphemeralBrowsingSupported(android.content.Context,java.lang.String)(context: https://developer.android.com/reference/android/content/Context.html, provider: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Checks whether the Custom Tabs provider supports Ephemeral Browsing. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#isSetNetworkSupported(android.content.Context,java.lang.String)(context: https://developer.android.com/reference/android/content/Context.html, provider: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Check whether the Custom Tabs provider supports multi-network feature `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsIntent.Builder#setNetwork(android.net.Network)`, i.e. be able to bind a custom tab to a particular network. |
| `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession?` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#newAuthTabSession(androidx.browser.auth.AuthTabCallback,java.util.concurrent.Executor)(callback: https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabCallback?, executor: https://developer.android.com/reference/java/util/concurrent/Executor.html?)` Creates a new session through an ICustomTabsService with the optional callback. |
| `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession?` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#newAuthTabSession(androidx.browser.auth.AuthTabCallback,java.util.concurrent.Executor,int)(callback: https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabCallback?, executor: https://developer.android.com/reference/java/util/concurrent/Executor.html?, id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Creates a new session through an ICustomTabsService with the optional callback. |
| `java-static https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSession.PendingSession` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#newPendingSession(android.content.Context,androidx.browser.customtabs.CustomTabsCallback,int)(context: https://developer.android.com/reference/android/content/Context.html, callback: https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsCallback?, id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Creates a new pending session with an optional callback. |
| `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSession?` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#newSession(androidx.browser.customtabs.CustomTabsCallback)(callback: https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsCallback?)` Creates a new session through an ICustomTabsService with the optional callback. |
| `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSession?` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#newSession(androidx.browser.customtabs.CustomTabsCallback,int)(callback: https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsCallback?, id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Creates a new session or updates a callback for the existing session through an ICustomTabsService. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#warmup(long)(flags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Warm up the browser process. |

## Public functions

### attachAuthTabSession

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

```
@ExperimentalPendingSession
fun attachAuthTabSession(session: AuthTabSession.PendingSession): AuthTabSession?
```

Associate `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession.PendingSession` with the service and turn it into an `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession`.

| Parameters |
|---|---|
| `session: https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession.PendingSession` | The `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession.PendingSession` to attach. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession?` | The `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession` that was created, or null if the browser doesn't support this feature. |

### attachSession

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

```
fun attachSession(session: CustomTabsSession.PendingSession): CustomTabsSession?
```

Associate `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSession.PendingSession` with the service and turn it into a `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSession`.

### bindCustomTabsService

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

```
java-static fun bindCustomTabsService(
    context: Context,
    packageName: String,
    connection: CustomTabsServiceConnection
): Boolean
```

Bind to a `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsService` using the given package name and `https://developer.android.com/reference/android/content/ServiceConnection.html`.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | `https://developer.android.com/reference/android/content/Context.html` to use while calling `https://developer.android.com/reference/android/content/Context.html#bindService(android.content.Intent, android.content.ServiceConnection, int)` |
| `packageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | Package name to set on the `https://developer.android.com/reference/android/content/Intent.html` for binding. |
| `connection: https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsServiceConnection` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsServiceConnection` to use when binding. This will return a `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient` on `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsServiceConnection` |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the binding was successful. |

### bindCustomTabsServicePreservePriority

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

```
java-static fun bindCustomTabsServicePreservePriority(
    context: Context,
    packageName: String,
    connection: CustomTabsServiceConnection
): Boolean
```

Bind to a `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsService` using the given package name and `https://developer.android.com/reference/android/content/ServiceConnection.html`. This is similar to `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#bindCustomTabsService(android.content.Context,java.lang.String,androidx.browser.customtabs.CustomTabsServiceConnection)` but does not use `https://developer.android.com/reference/android/content/Context.html#BIND_WAIVE_PRIORITY`, making it suitable for use cases where the browser is immediately going to be launched and breaking the connection would be unrecoverable.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | `https://developer.android.com/reference/android/content/Context.html` to use while calling `https://developer.android.com/reference/android/content/Context.html#bindService(android.content.Intent, android.content.ServiceConnection, int)` |
| `packageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | Package name to set on the `https://developer.android.com/reference/android/content/Intent.html` for binding. |
| `connection: https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsServiceConnection` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsServiceConnection` to use when binding. This will return a `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient` on `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsServiceConnection` |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the binding was successful. |

### connectAndInitialize

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

```
java-static fun connectAndInitialize(context: Context, packageName: String): Boolean
```

Connects to the Custom Tabs warmup service, and initializes the browser. This convenience method connects to the service, and immediately warms up the Custom Tabs implementation. Since service connection is asynchronous, the return code is not the return code of warmup. This call is optional, and clients are encouraged to connect to the service, call `warmup()` and create a session. In this case, calling this method is not necessary.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | `https://developer.android.com/reference/android/content/Context.html` to use to connect to the remote service. |
| `packageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | Package name of the target implementation. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the binding was successful. |

### createPendingAuthTabSession

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

```
@ExperimentalPendingSession
java-static fun createPendingAuthTabSession(context: Context, id: Int): AuthTabSession.PendingSession
```

Creates a new pending session without a callback. This session can be converted to a standard session using `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#attachSession(androidx.browser.customtabs.CustomTabsSession.PendingSession)` after connection.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | The `https://developer.android.com/reference/android/content/Context.html` to use. |
| `id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The session id. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession.PendingSession` | The newly created `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession.PendingSession`. |

### createPendingAuthTabSession

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

```
@ExperimentalPendingSession
java-static fun createPendingAuthTabSession(
    context: Context,
    id: Int,
    executor: Executor,
    callback: AuthTabCallback
): AuthTabSession.PendingSession
```

Creates a new pending session with a callback. This session can be converted to a standard session using `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#attachSession(androidx.browser.customtabs.CustomTabsSession.PendingSession)` after connection.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | The `https://developer.android.com/reference/android/content/Context.html` to use. |
| `id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The session id. |
| `executor: https://developer.android.com/reference/java/util/concurrent/Executor.html` | The `https://developer.android.com/reference/java/util/concurrent/Executor.html` to be used to execute the callbacks. |
| `callback: https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabCallback` | The callback through which the client will receive updates about the created session. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession.PendingSession` | The newly created `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession.PendingSession`. |

### extraCommand

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

```
fun extraCommand(commandName: String, args: Bundle?): Bundle?
```

Can be used as a channel between the Custom Tabs client and the provider to do something that is not part of the API yet.

### getPackageName

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

```
java-static fun getPackageName(context: Context, packages: (Mutable)List<String!>?): String?
```

Returns the preferred package to use for Custom Tabs, preferring the default VIEW handler.

### getPackageName

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

```
java-static fun getPackageName(
    context: Context,
    packages: (Mutable)List<String!>?,
    ignoreDefault: Boolean
): String?
```

Returns the preferred package to use for Custom Tabs. The preferred package name is the default VIEW intent handler as long as it supports Custom Tabs. To modify this preferred behavior, set `ignoreDefault` to true and give a non empty list of package names in `packages`. This method queries the `https://developer.android.com/reference/android/content/pm/PackageManager.html` to determine which packages support the Custom Tabs API. On apps that target Android 11 and above, this requires adding the following package visibility elements to your manifest.

```kotlin
<!-- Place inside the <queries> element. -->
<intent>
  <action android:name="android.support.customtabs.action.CustomTabsService" />
</intent>
```

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | `https://developer.android.com/reference/android/content/Context.html` to use for querying the packages. |
| `packages: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>?` | Ordered list of packages to test for Custom Tabs support, in decreasing order of priority. |
| `ignoreDefault: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | If set, the default VIEW handler won't get priority over other browsers. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | The preferred package name for handling Custom Tabs, or `null`. |

### isAuthTabSupported

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

```
java-static fun isAuthTabSupported(context: Context, provider: String): Boolean
```

Checks whether the Custom Tabs provider supports Auth Tab. See `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabIntent` for more information on how to launch an Auth Tab.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | The application `https://developer.android.com/reference/android/content/Context.html`. |
| `provider: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The package name of the Custom Tabs provider. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the Custom Tabs provider supports Auth Tab. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsService#CATEGORY_AUTH_TAB()` |   |

### isEphemeralBrowsingSupported

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

```
java-static fun isEphemeralBrowsingSupported(context: Context, provider: String): Boolean
```

Checks whether the Custom Tabs provider supports Ephemeral Browsing.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | The application `https://developer.android.com/reference/android/content/Context.html`. |
| `provider: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The package name of the Custom Tabs provider. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the Custom Tabs provider supports Ephemeral Browsing. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsService#CATEGORY_EPHEMERAL_BROWSING()` |   |

### isSetNetworkSupported

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

```
java-static fun isSetNetworkSupported(context: Context, provider: String): Boolean
```

Check whether the Custom Tabs provider supports multi-network feature `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsIntent.Builder#setNetwork(android.net.Network)`, i.e. be able to bind a custom tab to a particular network.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | Application context. |
| `provider: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the package name of Custom Tabs provider. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether a Custom Tabs provider supports multi-network feature. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsIntent.Builder#setNetwork(android.net.Network)` | and CustomTabsService#CATEGORY_SET_NETWORK. |

### newAuthTabSession

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

```
fun newAuthTabSession(callback: AuthTabCallback?, executor: Executor?): AuthTabSession?
```

Creates a new session through an ICustomTabsService with the optional callback. This session can be used to associate any related communication through the service with an intent and then later with a Custom Tab. The client can then send later service calls or intents to through same session-intent-Custom Tab association.

| Parameters |
|---|---|
| `callback: https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabCallback?` | The callback through which the client will receive updates about the created session. Can be null. |
| `executor: https://developer.android.com/reference/java/util/concurrent/Executor.html?` | The `https://developer.android.com/reference/java/util/concurrent/Executor.html` to be used to execute the callbacks. If null, the callbacks will be received on the UI thread. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession?` | The session object that was created as a result of the transaction. The client can use this to relay session specific calls. Null if the service failed to respond (threw a RemoteException). |

### newAuthTabSession

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

```
fun newAuthTabSession(callback: AuthTabCallback?, executor: Executor?, id: Int): AuthTabSession?
```

Creates a new session through an ICustomTabsService with the optional callback. This session can be used to associate any related communication through the service with an intent and then later with a Custom Tab. The client can then send later service calls or intents to through same session-intent-Custom Tab association.

| Parameters |
|---|---|
| `callback: https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabCallback?` | The callback through which the client will receive updates about the created session. Can be null. |
| `executor: https://developer.android.com/reference/java/util/concurrent/Executor.html?` | The `https://developer.android.com/reference/java/util/concurrent/Executor.html` to be used to execute the callbacks. If null, the callbacks will be received on the UI thread. |
| `id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The session id. If the session with the specified id already exists for the given client application, the new callback is supplied to that session and further attempts to launch URLs using that session will update the existing Auth Tab instead of launching a new one. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/browser/auth/AuthTabSession?` | The session object that was created as a result of the transaction. The client can use this to relay session specific calls. Null if the service failed to respond (threw a RemoteException). |

### newPendingSession

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

```
java-static fun newPendingSession(context: Context, callback: CustomTabsCallback?, id: Int): CustomTabsSession.PendingSession
```

Creates a new pending session with an optional callback. This session can be converted to a standard session using `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#attachSession(androidx.browser.customtabs.CustomTabsSession.PendingSession)` after connection. {@see PendingSession}

### newSession

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

```
fun newSession(callback: CustomTabsCallback?): CustomTabsSession?
```

Creates a new session through an ICustomTabsService with the optional callback. This session can be used to associate any related communication through the service with an intent and then later with a Custom Tab. The client can then send later service calls or intents to through same session-intent-Custom Tab association.

| Parameters |
|---|---|
| `callback: https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsCallback?` | The callback through which the client will receive updates about the created session. Can be null. All the callbacks will be received on the UI thread. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSession?` | The session object that was created as a result of the transaction. The client can use this to relay session specific calls. Null if the service failed to respond (threw a RemoteException). |

### newSession

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

```
fun newSession(callback: CustomTabsCallback?, id: Int): CustomTabsSession?
```

Creates a new session or updates a callback for the existing session through an ICustomTabsService. This session can be used to associate any related communication through the service with an intent and then later with a Custom Tab. The client can then send later service calls or intents to through same session-intent-Custom Tab association.

| Parameters |
|---|---|
| `callback: https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsCallback?` | The callback through which the client will receive updates about the created session. Can be null. All the callbacks will be received on the UI thread. |
| `id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The session id. If the session with the specified id already exists for the given client application, the new callback is supplied to that session and further attempts to launch URLs using that session will update the existing Custom Tab instead of launching a new one. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSession?` | The session object that was created as a result of the transaction. The client can use this to relay session specific calls. Null if the service failed to respond (threw a RemoteException). If `null` is returned, attempt using `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsClient#newSession(androidx.browser.customtabs.CustomTabsCallback)` which is supported with older browsers. |

### warmup

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

```
fun warmup(flags: Long): Boolean
```

Warm up the browser process. Allows the browser application to pre-initialize itself in the background. Significantly speeds up URL opening in the browser. This is asynchronous and can be called several times.

| Parameters |
|---|---|
| `flags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | Reserved for future use. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the warmup was successful. |