# TvInputManager.TvInputCallback

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# TvInputCallback

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/media/tv/TvInputManager.TvInputCallback "View this page in Java")  

```
abstract class TvInputCallback
```

|---|----------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                     ||
| ↳ | [android.media.tv.TvInputManager.TvInputCallback](https://developer.android.com/reference/kotlin/android/media/tv/TvInputManager.TvInputCallback#) |

Callback used to monitor status of the TV inputs.

## Summary

|                                                                Public constructors                                                                ||
|------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [TvInputCallback](https://developer.android.com/reference/kotlin/android/media/tv/TvInputManager.TvInputCallback#TvInputCallback())`()` <br /> |

|                                                                                                                                                                                                                                                 Public methods                                                                                                                                                                                                                                                  ||
|----------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onInputAdded](https://developer.android.com/reference/kotlin/android/media/tv/TvInputManager.TvInputCallback#onInputAdded(kotlin.String))`(`inputId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` This is called when a TV input is added to the system.                                                                                                                           |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onInputRemoved](https://developer.android.com/reference/kotlin/android/media/tv/TvInputManager.TvInputCallback#onInputRemoved(kotlin.String))`(`inputId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` This is called when a TV input is removed from the system.                                                                                                                   |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onInputStateChanged](https://developer.android.com/reference/kotlin/android/media/tv/TvInputManager.TvInputCallback#onInputStateChanged(kotlin.String,%20kotlin.Int))`(`inputId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `state:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` This is called when the state of a given TV input is changed. |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onInputUpdated](https://developer.android.com/reference/kotlin/android/media/tv/TvInputManager.TvInputCallback#onInputUpdated(kotlin.String))`(`inputId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` This is called when a TV input is updated on the system.                                                                                                                     |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onTvInputInfoUpdated](https://developer.android.com/reference/kotlin/android/media/tv/TvInputManager.TvInputCallback#onTvInputInfoUpdated(android.media.tv.TvInputInfo))`(`inputInfo:` `[TvInputInfo](https://developer.android.com/reference/kotlin/android/media/tv/TvInputInfo)!`)` This is called when the information about an existing TV input has been updated.                                                      |

## Public constructors

### TvInputCallback

```
TvInputCallback()
```

## Public methods

### onInputAdded

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onInputAdded(inputId: String!): Unit
```

This is called when a TV input is added to the system.

Normally it happens when the user installs a new TV input package that implements[TvInputService](https://developer.android.com/reference/kotlin/android/media/tv/TvInputService)interface.

|                                                      Parameters                                                      ||
|-----------|-----------------------------------------------------------------------------------------------------------|
| `inputId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:The ID of the TV input. |

### onInputRemoved

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onInputRemoved(inputId: String!): Unit
```

This is called when a TV input is removed from the system.

Normally it happens when the user uninstalls the previously installed TV input package.

|                                                      Parameters                                                      ||
|-----------|-----------------------------------------------------------------------------------------------------------|
| `inputId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:The ID of the TV input. |

### onInputStateChanged

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onInputStateChanged(
    inputId: String!, 
    state: Int
): Unit
```

This is called when the state of a given TV input is changed.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ||
|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `inputId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:The ID of the TV input.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `state`   | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):State of the TV input. The value is one of the following: - [TvInputManager.INPUT_STATE_CONNECTED](https://developer.android.com/reference/kotlin/android/media/tv/TvInputManager#INPUT_STATE_CONNECTED:kotlin.Int) - [TvInputManager.INPUT_STATE_CONNECTED_STANDBY](https://developer.android.com/reference/kotlin/android/media/tv/TvInputManager#INPUT_STATE_CONNECTED_STANDBY:kotlin.Int) - [TvInputManager.INPUT_STATE_DISCONNECTED](https://developer.android.com/reference/kotlin/android/media/tv/TvInputManager#INPUT_STATE_DISCONNECTED:kotlin.Int) Value is[android.media.tv.TvInputManager#INPUT_STATE_CONNECTED](https://developer.android.com/reference/kotlin/android/media/tv/TvInputManager#INPUT_STATE_CONNECTED:kotlin.Int),[android.media.tv.TvInputManager#INPUT_STATE_CONNECTED_STANDBY](https://developer.android.com/reference/kotlin/android/media/tv/TvInputManager#INPUT_STATE_CONNECTED_STANDBY:kotlin.Int), or[android.media.tv.TvInputManager#INPUT_STATE_DISCONNECTED](https://developer.android.com/reference/kotlin/android/media/tv/TvInputManager#INPUT_STATE_DISCONNECTED:kotlin.Int) |

### onInputUpdated

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onInputUpdated(inputId: String!): Unit
```

This is called when a TV input is updated on the system.

Normally it happens when a previously installed TV input package is re-installed or the media on which a newer version of the package exists becomes available/unavailable.

|                                                      Parameters                                                      ||
|-----------|-----------------------------------------------------------------------------------------------------------|
| `inputId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:The ID of the TV input. |

### onTvInputInfoUpdated

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onTvInputInfoUpdated(inputInfo: TvInputInfo!): Unit
```

This is called when the information about an existing TV input has been updated.

Because the system automatically creates a`TvInputInfo`object for each TV input based on the information collected from the`AndroidManifest.xml`, this method is only called back when such information has changed dynamically.

|                                                                           Parameters                                                                           ||
|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------|
| `inputInfo` | [TvInputInfo](https://developer.android.com/reference/kotlin/android/media/tv/TvInputInfo)!:The`TvInputInfo`object that contains new information. |