# CustomTabsServiceConnection

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:[Ctors](https://developer.android.com/reference/android/support/customtabs/CustomTabsServiceConnection#pubctors)\|[Methods](https://developer.android.com/reference/android/support/customtabs/CustomTabsServiceConnection#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/customtabs/CustomTabsServiceConnection#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/customtabs/CustomTabsServiceConnection#)  

# CustomTabsServiceConnection

| 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


abstract
class
CustomTabsServiceConnection
`  
`

extends Object


``


implements

`[ServiceConnection](https://developer.android.com/reference/android/content/ServiceConnection.html)`


`

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

<br />

*** ** * ** ***

Abstract[ServiceConnection](https://developer.android.com/reference/android/content/ServiceConnection.html)to use while binding to a[CustomTabsService](https://developer.android.com/reference/android/support/customtabs/CustomTabsService). Any client implementing this is responsible for handling changes related with the lifetime of the connection like rebinding on disconnect.

## Summary

|                                                                        ### Public constructors                                                                         ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[CustomTabsServiceConnection](https://developer.android.com/reference/android/support/customtabs/CustomTabsServiceConnection#CustomTabsServiceConnection())`() ` |

|                                                                                                                                                                                                                                                                                                                 ### Public methods                                                                                                                                                                                                                                                                                                                  ||
|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract void` | ` `[onCustomTabsServiceConnected](https://developer.android.com/reference/android/support/customtabs/CustomTabsServiceConnection#onCustomTabsServiceConnected(android.content.ComponentName, android.support.customtabs.CustomTabsClient))`(`[ComponentName](https://developer.android.com/reference/android/content/ComponentName.html)` name, `[CustomTabsClient](https://developer.android.com/reference/android/support/customtabs/CustomTabsClient)` client) ` Called when a connection to the[CustomTabsService](https://developer.android.com/reference/android/support/customtabs/CustomTabsService)has been established. |
| ` final void`    | ` `[onServiceConnected](https://developer.android.com/reference/android/support/customtabs/CustomTabsServiceConnection#onServiceConnected(android.content.ComponentName, android.os.IBinder))`(`[ComponentName](https://developer.android.com/reference/android/content/ComponentName.html)` name, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` service) `                                                                                                                                                                                                                                        |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/customtabs/CustomTabsServiceConnection#)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() `                    | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/customtabs/CustomTabsServiceConnection#)From interface` `[android.content.ServiceConnection](https://developer.android.com/reference/android/content/ServiceConnection.html)` ` |------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` default void`  | ` onBindingDied(`[ComponentName](https://developer.android.com/reference/android/content/ComponentName.html)` arg0) `                                                                                         | | ` default void`  | ` onNullBinding(`[ComponentName](https://developer.android.com/reference/android/content/ComponentName.html)` arg0) `                                                                                         | | ` abstract void` | ` onServiceConnected(`[ComponentName](https://developer.android.com/reference/android/content/ComponentName.html)` arg0, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg1) ` | | ` abstract void` | ` onServiceDisconnected(`[ComponentName](https://developer.android.com/reference/android/content/ComponentName.html)` arg0) `                                                                                 | ||

## Public constructors

### CustomTabsServiceConnection

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

```
CustomTabsServiceConnection ()
```

<br />

<br />

## Public methods

### onCustomTabsServiceConnected

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

```
void onCustomTabsServiceConnected (ComponentName name, 
                CustomTabsClient client)
```

Called when a connection to the[CustomTabsService](https://developer.android.com/reference/android/support/customtabs/CustomTabsService)has been established.

<br />

|                                                                                                                                                                       Parameters                                                                                                                                                                        ||
|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `name`   | `ComponentName`: The concrete component name of the service that has been connected. <br />                                                                                                                                                                                                                                                   |
| `client` | `CustomTabsClient`:[CustomTabsClient](https://developer.android.com/reference/android/support/customtabs/CustomTabsClient)that contains the[IBinder](https://developer.android.com/reference/android/os/IBinder.html)with which the connection have been established. All further communication should be initiated using this client. <br /> |

### onServiceConnected

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

```
void onServiceConnected (ComponentName name, 
                IBinder service)
```

<br />

<br />

|            Parameters             ||
|-----------|------------------------|
| `name`    | `ComponentName` <br /> |
| `service` | `IBinder` <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)