# CustomTabsSessionToken

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:customtabs:28.0.0-alpha1  
Summary:[Methods](https://developer.android.com/reference/android/support/customtabs/CustomTabsSessionToken#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/customtabs/CustomTabsSessionToken#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/customtabs/CustomTabsSessionToken#)  

# CustomTabsSessionToken

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public


class
CustomTabsSessionToken
`  
`

extends Object


``


`

|---|---------------------------------------------------|
| java.lang.Object                                     ||
| ↳ | android.support.customtabs.CustomTabsSessionToken |

<br />

*** ** * ** ***

Wrapper class that can be used as a unique identifier for a session. Also contains an accessor for the[CustomTabsCallback](https://developer.android.com/reference/android/support/customtabs/CustomTabsCallback)for the session if there was any.

## Summary

|                                                                                                                                                                                                                                                                ### Public methods                                                                                                                                                                                                                                                                ||
|-------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static `[CustomTabsSessionToken](https://developer.android.com/reference/android/support/customtabs/CustomTabsSessionToken) | ` `[createMockSessionTokenForTesting](https://developer.android.com/reference/android/support/customtabs/CustomTabsSessionToken#createMockSessionTokenForTesting())`() ` Provides browsers a way to generate a mock[CustomTabsSessionToken](https://developer.android.com/reference/android/support/customtabs/CustomTabsSessionToken)for testing purposes.                                                       |
| ` boolean`                                                                                                                    | ` `[equals](https://developer.android.com/reference/android/support/customtabs/CustomTabsSessionToken#equals(java.lang.Object))`(Object o) `                                                                                                                                                                                                                                                                      |
| ` `[CustomTabsCallback](https://developer.android.com/reference/android/support/customtabs/CustomTabsCallback)                | ` `[getCallback](https://developer.android.com/reference/android/support/customtabs/CustomTabsSessionToken#getCallback())`() `                                                                                                                                                                                                                                                                                    |
| ` static `[CustomTabsSessionToken](https://developer.android.com/reference/android/support/customtabs/CustomTabsSessionToken) | ` `[getSessionTokenFromIntent](https://developer.android.com/reference/android/support/customtabs/CustomTabsSessionToken#getSessionTokenFromIntent(android.content.Intent))`(`[Intent](https://developer.android.com/reference/android/content/Intent.html)` intent) ` Obtain a[CustomTabsSessionToken](https://developer.android.com/reference/android/support/customtabs/CustomTabsSessionToken)from an intent. |
| ` int`                                                                                                                        | ` `[hashCode](https://developer.android.com/reference/android/support/customtabs/CustomTabsSessionToken#hashCode())`() `                                                                                                                                                                                                                                                                                          |
| ` boolean`                                                                                                                    | ` `[isAssociatedWith](https://developer.android.com/reference/android/support/customtabs/CustomTabsSessionToken#isAssociatedWith(android.support.customtabs.CustomTabsSession))`(`[CustomTabsSession](https://developer.android.com/reference/android/support/customtabs/CustomTabsSession)` session) `                                                                                                           |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/customtabs/CustomTabsSessionToken#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Public methods

### createMockSessionTokenForTesting

added in[version 27.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
CustomTabsSessionToken createMockSessionTokenForTesting ()
```

Provides browsers a way to generate a mock[CustomTabsSessionToken](https://developer.android.com/reference/android/support/customtabs/CustomTabsSessionToken)for testing purposes.

<br />

|                                                                             Returns                                                                             ||
|---------------------------------------------------------------------------------------------------------------------|--------------------------------------------|
| [CustomTabsSessionToken](https://developer.android.com/reference/android/support/customtabs/CustomTabsSessionToken) | A mock token with no functionality. <br /> |

### equals

```
boolean equals (Object o)
```

<br />

<br />

|      Parameters      ||
|-----|-----------------|
| `o` | `Object` <br /> |

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### getCallback

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
CustomTabsCallback getCallback ()
```

<br />

<br />

|                                                                                                                                                        Returns                                                                                                                                                         ||
|-------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [CustomTabsCallback](https://developer.android.com/reference/android/support/customtabs/CustomTabsCallback) | [CustomTabsCallback](https://developer.android.com/reference/android/support/customtabs/CustomTabsCallback)corresponding to this session if there was any non-null callbacks passed by the client. <br /> |

### getSessionTokenFromIntent

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
CustomTabsSessionToken getSessionTokenFromIntent (Intent intent)
```

Obtain a[CustomTabsSessionToken](https://developer.android.com/reference/android/support/customtabs/CustomTabsSessionToken)from an intent. See[CustomTabsIntent.Builder](https://developer.android.com/reference/android/support/customtabs/CustomTabsIntent.Builder)for ways to generate an intent for custom tabs.

<br />

|                                                                                                      Parameters                                                                                                       ||
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `intent` | `Intent`: The intent to generate the token from. This has to include an extra for[EXTRA_SESSION](https://developer.android.com/reference/android/support/customtabs/CustomTabsIntent#EXTRA_SESSION). <br /> |

|                                                                          Returns                                                                          ||
|---------------------------------------------------------------------------------------------------------------------|--------------------------------------|
| [CustomTabsSessionToken](https://developer.android.com/reference/android/support/customtabs/CustomTabsSessionToken) | The token that was generated. <br /> |

### hashCode

```
int hashCode ()
```

<br />

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### isAssociatedWith

added in[version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean isAssociatedWith (CustomTabsSession session)
```

<br />

<br />

|              Parameters               ||
|-----------|----------------------------|
| `session` | `CustomTabsSession` <br /> |

|                                  Returns                                   ||
|-----------|-----------------------------------------------------------------|
| `boolean` | Whether this token is associated with the given session. <br /> |

-

  ## Annotations

  - [CustomTabsService.Relation](https://developer.android.com/reference/android/support/customtabs/CustomTabsService.Relation)
  - [CustomTabsService.Result](https://developer.android.com/reference/android/support/customtabs/CustomTabsService.Result)
-

  ## Classes

  - [CustomTabsCallback](https://developer.android.com/reference/android/support/customtabs/CustomTabsCallback)
  - [CustomTabsClient](https://developer.android.com/reference/android/support/customtabs/CustomTabsClient)
  - [CustomTabsIntent](https://developer.android.com/reference/android/support/customtabs/CustomTabsIntent)
  - [CustomTabsIntent.Builder](https://developer.android.com/reference/android/support/customtabs/CustomTabsIntent.Builder)
  - [CustomTabsService](https://developer.android.com/reference/android/support/customtabs/CustomTabsService)
  - [CustomTabsServiceConnection](https://developer.android.com/reference/android/support/customtabs/CustomTabsServiceConnection)
  - [CustomTabsSession](https://developer.android.com/reference/android/support/customtabs/CustomTabsSession)
  - [CustomTabsSessionToken](https://developer.android.com/reference/android/support/customtabs/CustomTabsSessionToken)
  - [PostMessageService](https://developer.android.com/reference/android/support/customtabs/PostMessageService)
  - [PostMessageServiceConnection](https://developer.android.com/reference/android/support/customtabs/PostMessageServiceConnection)
  - [R](https://developer.android.com/reference/android/support/customtabs/R)
  - [R.anim](https://developer.android.com/reference/android/support/customtabs/R.anim)
  - [R.attr](https://developer.android.com/reference/android/support/customtabs/R.attr)
  - [R.bool](https://developer.android.com/reference/android/support/customtabs/R.bool)
  - [R.color](https://developer.android.com/reference/android/support/customtabs/R.color)
  - [R.dimen](https://developer.android.com/reference/android/support/customtabs/R.dimen)
  - [R.drawable](https://developer.android.com/reference/android/support/customtabs/R.drawable)
  - [R.id](https://developer.android.com/reference/android/support/customtabs/R.id)
  - [R.integer](https://developer.android.com/reference/android/support/customtabs/R.integer)
  - [R.layout](https://developer.android.com/reference/android/support/customtabs/R.layout)
  - [R.string](https://developer.android.com/reference/android/support/customtabs/R.string)
  - [R.style](https://developer.android.com/reference/android/support/customtabs/R.style)
  - [R.styleable](https://developer.android.com/reference/android/support/customtabs/R.styleable)
  - [TrustedWebUtils](https://developer.android.com/reference/android/support/customtabs/TrustedWebUtils)