# 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)

*** ** * ** ***


```
public class CustomTabsClient
```

<br />

*** ** * ** ***

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

## Summary

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/browser/auth/AuthTabSession` | `@https://developer.android.com/reference/androidx/browser/customtabs/ExperimentalPendingSession https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#attachAuthTabSession(androidx.browser.auth.AuthTabSession.PendingSession)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/auth/AuthTabSession.PendingSession session)` Associate `https://developer.android.com/reference/androidx/browser/auth/AuthTabSession.PendingSession` with the service and turn it into an `https://developer.android.com/reference/androidx/browser/auth/AuthTabSession`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession` | `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#attachSession(androidx.browser.customtabs.CustomTabsSession.PendingSession)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession.PendingSession session)` Associate `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession.PendingSession` with the service and turn it into a `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession`. |
| `static boolean` | `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#bindCustomTabsService(android.content.Context,java.lang.String,androidx.browser.customtabs.CustomTabsServiceConnection)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html packageName, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsServiceConnection connection )` Bind to a `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsService` using the given package name and `https://developer.android.com/reference/android/content/ServiceConnection.html`. |
| `static boolean` | `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#bindCustomTabsServicePreservePriority(android.content.Context,java.lang.String,androidx.browser.customtabs.CustomTabsServiceConnection)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html packageName, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsServiceConnection connection )` Bind to a `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsService` using the given package name and `https://developer.android.com/reference/android/content/ServiceConnection.html`. |
| `static boolean` | `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#connectAndInitialize(android.content.Context,java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html packageName)` Connects to the Custom Tabs warmup service, and initializes the browser. |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/auth/AuthTabSession.PendingSession` | `@https://developer.android.com/reference/androidx/browser/customtabs/ExperimentalPendingSession https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#createPendingAuthTabSession(android.content.Context,int)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, int id)` Creates a new pending session without a callback. |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/auth/AuthTabSession.PendingSession` | `@https://developer.android.com/reference/androidx/browser/customtabs/ExperimentalPendingSession https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#createPendingAuthTabSession(android.content.Context,int,java.util.concurrent.Executor,androidx.browser.auth.AuthTabCallback)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, int id, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/concurrent/Executor.html executor, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/auth/AuthTabCallback callback )` Creates a new pending session with a callback. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#extraCommand(java.lang.String,android.os.Bundle)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html commandName, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html args)` 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. |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#getPackageName(android.content.Context,java.util.List<java.lang.String>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html> packages)` Returns the preferred package to use for Custom Tabs, preferring the default VIEW handler. |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#getPackageName(android.content.Context,java.util.List<java.lang.String>,boolean)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html> packages, boolean ignoreDefault )` Returns the preferred package to use for Custom Tabs. |
| `static boolean` | `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#isAuthTabSupported(android.content.Context,java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html provider)` Checks whether the Custom Tabs provider supports Auth Tab. |
| `static boolean` | `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#isEphemeralBrowsingSupported(android.content.Context,java.lang.String)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html provider )` Checks whether the Custom Tabs provider supports Ephemeral Browsing. |
| `static boolean` | `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#isSetNetworkSupported(android.content.Context,java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html provider)` Check whether the Custom Tabs provider supports multi-network feature `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setNetwork(android.net.Network)`, i.e. be able to bind a custom tab to a particular network. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/browser/auth/AuthTabSession` | `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#newAuthTabSession(androidx.browser.auth.AuthTabCallback,java.util.concurrent.Executor)( @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/browser/auth/AuthTabCallback callback, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/concurrent/Executor.html executor )` Creates a new session through an ICustomTabsService with the optional callback. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/browser/auth/AuthTabSession` | `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#newAuthTabSession(androidx.browser.auth.AuthTabCallback,java.util.concurrent.Executor,int)( @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/browser/auth/AuthTabCallback callback, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/concurrent/Executor.html executor, int id )` Creates a new session through an ICustomTabsService with the optional callback. |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession.PendingSession` | `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#newPendingSession(android.content.Context,androidx.browser.customtabs.CustomTabsCallback,int)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsCallback callback, int id )` Creates a new pending session with an optional callback. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession` | `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#newSession(androidx.browser.customtabs.CustomTabsCallback)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsCallback callback)` Creates a new session through an ICustomTabsService with the optional callback. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession` | `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#newSession(androidx.browser.customtabs.CustomTabsCallback,int)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsCallback callback, int id)` Creates a new session or updates a callback for the existing session through an ICustomTabsService. |
| `boolean` | `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#warmup(long)(long flags)` Warm up the browser process. |

## Public methods

### attachAuthTabSession

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

```
@ExperimentalPendingSession
public @Nullable AuthTabSession attachAuthTabSession(@NonNull AuthTabSession.PendingSession session)
```

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/auth/AuthTabSession.PendingSession session` | The `https://developer.android.com/reference/androidx/browser/auth/AuthTabSession.PendingSession` to attach. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/browser/auth/AuthTabSession` | The `https://developer.android.com/reference/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)

```
public @Nullable CustomTabsSession attachSession(@NonNull CustomTabsSession.PendingSession session)
```

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

### bindCustomTabsService

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

```
public static boolean bindCustomTabsService(
    @NonNull Context context,
    @NonNull String packageName,
    @NonNull CustomTabsServiceConnection connection
)
```

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | `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)` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html packageName` | Package name to set on the `https://developer.android.com/reference/android/content/Intent.html` for binding. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsServiceConnection connection` | `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsServiceConnection` to use when binding. This will return a `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient` on `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsServiceConnection` |

| Returns |
|---|---|
| `boolean` | Whether the binding was successful. |

### bindCustomTabsServicePreservePriority

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

```
public static boolean bindCustomTabsServicePreservePriority(
    @NonNull Context context,
    @NonNull String packageName,
    @NonNull CustomTabsServiceConnection connection
)
```

Bind to a `https://developer.android.com/reference/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/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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | `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)` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html packageName` | Package name to set on the `https://developer.android.com/reference/android/content/Intent.html` for binding. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsServiceConnection connection` | `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsServiceConnection` to use when binding. This will return a `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient` on `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsServiceConnection` |

| Returns |
|---|---|
| `boolean` | Whether the binding was successful. |

### connectAndInitialize

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

```
public static boolean connectAndInitialize(@NonNull Context context, @NonNull String packageName)
```

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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | `https://developer.android.com/reference/android/content/Context.html` to use to connect to the remote service. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html packageName` | Package name of the target implementation. |

| Returns |
|---|---|
| `boolean` | Whether the binding was successful. |

### createPendingAuthTabSession

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

```
@ExperimentalPendingSession
public static @NonNull AuthTabSession.PendingSession createPendingAuthTabSession(@NonNull Context context, int id)
```

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | The `https://developer.android.com/reference/android/content/Context.html` to use. |
| `int id` | The session id. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/auth/AuthTabSession.PendingSession` | The newly created `https://developer.android.com/reference/androidx/browser/auth/AuthTabSession.PendingSession`. |

### createPendingAuthTabSession

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

```
@ExperimentalPendingSession
public static @NonNull AuthTabSession.PendingSession createPendingAuthTabSession(
    @NonNull Context context,
    int id,
    @NonNull Executor executor,
    @NonNull AuthTabCallback callback
)
```

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

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

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/auth/AuthTabSession.PendingSession` | The newly created `https://developer.android.com/reference/androidx/browser/auth/AuthTabSession.PendingSession`. |

### extraCommand

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

```
public @Nullable Bundle extraCommand(@NonNull String commandName, @Nullable Bundle args)
```

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)

```
public static @Nullable String getPackageName(@NonNull Context context, @Nullable List<String> packages)
```

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)

```
public static @Nullable String getPackageName(
    @NonNull Context context,
    @Nullable List<String> packages,
    boolean ignoreDefault
)
```

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.

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | `https://developer.android.com/reference/android/content/Context.html` to use for querying the packages. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html> packages` | Ordered list of packages to test for Custom Tabs support, in decreasing order of priority. |
| `boolean ignoreDefault` | If set, the default VIEW handler won't get priority over other browsers. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.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)

```
public static boolean isAuthTabSupported(@NonNull Context context, @NonNull String provider)
```

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | The application `https://developer.android.com/reference/android/content/Context.html`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html provider` | The package name of the Custom Tabs provider. |

| Returns |
|---|---|
| `boolean` | Whether the Custom Tabs provider supports Auth Tab. |

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

### isEphemeralBrowsingSupported

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

```
public static boolean isEphemeralBrowsingSupported(
    @NonNull Context context,
    @NonNull String provider
)
```

Checks whether the Custom Tabs provider supports Ephemeral Browsing.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | The application `https://developer.android.com/reference/android/content/Context.html`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html provider` | The package name of the Custom Tabs provider. |

| Returns |
|---|---|
| `boolean` | Whether the Custom Tabs provider supports Ephemeral Browsing. |

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

### isSetNetworkSupported

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

```
public static boolean isSetNetworkSupported(@NonNull Context context, @NonNull String provider)
```

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | Application context. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html provider` | the package name of Custom Tabs provider. |

| Returns |
|---|---|
| `boolean` | whether a Custom Tabs provider supports multi-network feature. |

| See also |
|---|---|
| `https://developer.android.com/reference/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)

```
public @Nullable AuthTabSession newAuthTabSession(
    @Nullable AuthTabCallback callback,
    @Nullable Executor executor
)
```

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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/browser/auth/AuthTabCallback callback` | The callback through which the client will receive updates about the created session. Can be null. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/concurrent/Executor.html executor` | 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://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/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)

```
public @Nullable AuthTabSession newAuthTabSession(
    @Nullable AuthTabCallback callback,
    @Nullable Executor executor,
    int id
)
```

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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/browser/auth/AuthTabCallback callback` | The callback through which the client will receive updates about the created session. Can be null. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/concurrent/Executor.html executor` | 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. |
| `int id` | 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://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/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)

```
public static @NonNull CustomTabsSession.PendingSession newPendingSession(
    @NonNull Context context,
    @Nullable CustomTabsCallback callback,
    int id
)
```

Creates a new pending session with an optional callback. This session can be converted to a standard session using `https://developer.android.com/reference/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)

```
public @Nullable CustomTabsSession newSession(@Nullable CustomTabsCallback callback)
```

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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsCallback callback` | 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://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/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)

```
public @Nullable CustomTabsSession newSession(@Nullable CustomTabsCallback callback, int id)
```

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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsCallback callback` | 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. |
| `int id` | 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://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/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/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)

```
public boolean warmup(long flags)
```

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 |
|---|---|
| `long flags` | Reserved for future use. |

| Returns |
|---|---|
| `boolean` | Whether the warmup was successful. |