# CustomTabsSessionToken

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

*** ** * ** ***


```
class CustomTabsSessionToken
```

<br />

*** ** * ** ***

Wrapper class that can be used as a unique identifier for a session. Also contains an accessor for the `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsCallback` for the session if there was any.

## Summary

| ### Public functions |
|---|---|
| `java-static https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSessionToken` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSessionToken#createMockSessionTokenForTesting()()` Provides browsers a way to generate a mock `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSessionToken` for testing purposes. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSessionToken#equals(java.lang.Object)(o: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!)` |
| `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsCallback?` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSessionToken#getCallback()()` |
| `java-static https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSessionToken?` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSessionToken#getSessionTokenFromIntent(android.content.Intent)(intent: https://developer.android.com/reference/android/content/Intent.html)` Obtain a `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSessionToken` from an intent. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSessionToken#hashCode()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSessionToken#isAssociatedWith(androidx.browser.customtabs.CustomTabsSession)(session: https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSession)` |

## Public functions

### createMockSessionTokenForTesting

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

```
java-static fun createMockSessionTokenForTesting(): CustomTabsSessionToken
```

Provides browsers a way to generate a mock `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSessionToken` for testing purposes.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSessionToken` | A mock token with no functionality. |

### equals

```
fun equals(o: Any!): Boolean
```

### getCallback

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

```
fun getCallback(): CustomTabsCallback?
```

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsCallback?` | `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsCallback` corresponding to this session if there was any non-null callbacks passed by the client. |

### getSessionTokenFromIntent

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

```
java-static fun getSessionTokenFromIntent(intent: Intent): CustomTabsSessionToken?
```

Obtain a `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSessionToken` from an intent. See `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsIntent.Builder` for ways to generate an intent for custom tabs.

| Parameters |
|---|---|
| `intent: https://developer.android.com/reference/android/content/Intent.html` | The intent to generate the token from. This has to include an extra for `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsIntent#EXTRA_SESSION()`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/browser/customtabs/CustomTabsSessionToken?` | The token that was generated. |

### hashCode

```
fun hashCode(): Int
```

### isAssociatedWith

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

```
fun isAssociatedWith(session: CustomTabsSession): Boolean
```

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether this token is associated with the given session. |