# TvAdView.TvAdCallback

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

# TvAdCallback

*** ** * ** ***

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

```
abstract class TvAdCallback
```

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

Callback used to receive various status updates on the[TvAdView](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdView).

## Summary

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

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ||
|----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onRequestCurrentChannelUri](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdView.TvAdCallback#onRequestCurrentChannelUri(kotlin.String))`(`serviceId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` This is called when[TvAdService.Session.requestCurrentChannelUri()](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdService.Session#requestCurrentChannelUri())is called.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onRequestCurrentTvInputId](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdView.TvAdCallback#onRequestCurrentTvInputId(kotlin.String))`(`serviceId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` This is called when[TvAdService.Session.requestCurrentTvInputId()](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdService.Session#requestCurrentTvInputId())is called.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onRequestCurrentVideoBounds](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdView.TvAdCallback#onRequestCurrentVideoBounds(kotlin.String))`(`serviceId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` This is called when[TvAdService.Session.requestCurrentVideoBounds()](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdService.Session#requestCurrentVideoBounds())is called.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onRequestSigning](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdView.TvAdCallback#onRequestSigning(kotlin.String,%20kotlin.String,%20kotlin.String,%20kotlin.String,%20kotlin.ByteArray))`(`serviceId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `signingId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `algorithm:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `alias:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `data:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)`)` This is called when[TvAdService.Session.requestSigning(String, String, String, byte[])](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdService.Session#requestSigning(kotlin.String,%20kotlin.String,%20kotlin.String,%20kotlin.ByteArray))is called. |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onRequestTrackInfoList](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdView.TvAdCallback#onRequestTrackInfoList(kotlin.String))`(`serviceId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` This is called when[TvAdService.Session.requestTrackInfoList()](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdService.Session#requestTrackInfoList())is called.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onStateChanged](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdView.TvAdCallback#onStateChanged(kotlin.String,%20kotlin.Int,%20kotlin.Int))`(`serviceId:` `[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)`, `err:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` This is called when the state of corresponding AD service is changed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

## Public constructors

### TvAdCallback

```
TvAdCallback()
```

## Public methods

### onRequestCurrentChannelUri

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

```
open fun onRequestCurrentChannelUri(serviceId: String): Unit
```

This is called when[TvAdService.Session.requestCurrentChannelUri()](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdService.Session#requestCurrentChannelUri())is called.

|                                                                               Parameters                                                                               ||
|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `serviceId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):The ID of the AD service bound to this view. This value cannot be`null`. |

### onRequestCurrentTvInputId

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

```
open fun onRequestCurrentTvInputId(serviceId: String): Unit
```

This is called when[TvAdService.Session.requestCurrentTvInputId()](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdService.Session#requestCurrentTvInputId())is called.

|                                                                               Parameters                                                                               ||
|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `serviceId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):The ID of the AD service bound to this view. This value cannot be`null`. |

### onRequestCurrentVideoBounds

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

```
open fun onRequestCurrentVideoBounds(serviceId: String): Unit
```

This is called when[TvAdService.Session.requestCurrentVideoBounds()](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdService.Session#requestCurrentVideoBounds())is called.

|                                                                                Parameters                                                                                 ||
|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `serviceId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):The ID of the TV AD service bound to this view. This value cannot be`null`. |

### onRequestSigning

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

```
open fun onRequestSigning(
    serviceId: String, 
    signingId: String, 
    algorithm: String, 
    alias: String, 
    data: ByteArray
): Unit
```

This is called when[TvAdService.Session.requestSigning(String, String, String, byte[])](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdService.Session#requestSigning(kotlin.String,%20kotlin.String,%20kotlin.String,%20kotlin.ByteArray))is called.

|                                                                                                                           Parameters                                                                                                                           ||
|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `serviceId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):The ID of the AD service bound to this view. This value cannot be`null`.                                                                                         |
| `signingId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):the ID to identify the request. This value cannot be`null`.                                                                                                      |
| `algorithm` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):the standard name of the signature algorithm requested, such as MD5withRSA, SHA256withDSA, etc. This value cannot be`null`.                                      |
| `alias`     | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):the alias of the corresponding[java.security.KeyStore](https://developer.android.com/reference/kotlin/java/security/KeyStore.html#). This value cannot be`null`. |
| `data`      | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html):the original bytes to be signed. This value cannot be`null`.                                                                                              |

### onRequestTrackInfoList

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

```
open fun onRequestTrackInfoList(serviceId: String): Unit
```

This is called when[TvAdService.Session.requestTrackInfoList()](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdService.Session#requestTrackInfoList())is called.

|                                                                               Parameters                                                                               ||
|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `serviceId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):The ID of the AD service bound to this view. This value cannot be`null`. |

### onStateChanged

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

```
open fun onStateChanged(
    serviceId: String, 
    state: Int, 
    err: Int
): Unit
```

This is called when the state of corresponding AD service is changed.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ||
|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `serviceId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):The ID of the AD service bound to this view. This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `state`     | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the current state. Value is[android.media.tv.ad.TvAdManager#SESSION_STATE_STOPPED](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdManager#SESSION_STATE_STOPPED:kotlin.Int),[android.media.tv.ad.TvAdManager#SESSION_STATE_RUNNING](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdManager#SESSION_STATE_RUNNING:kotlin.Int), or[android.media.tv.ad.TvAdManager#SESSION_STATE_ERROR](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdManager#SESSION_STATE_ERROR:kotlin.Int)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `err`       | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the error code for error state.[TvAdManager.ERROR_NONE](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdManager#ERROR_NONE:kotlin.Int)is used when the state is not[TvAdManager.SESSION_STATE_ERROR](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdManager#SESSION_STATE_ERROR:kotlin.Int). Value is[android.media.tv.ad.TvAdManager#ERROR_NONE](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdManager#ERROR_NONE:kotlin.Int),[android.media.tv.ad.TvAdManager#ERROR_UNKNOWN](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdManager#ERROR_UNKNOWN:kotlin.Int),[android.media.tv.ad.TvAdManager#ERROR_NOT_SUPPORTED](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdManager#ERROR_NOT_SUPPORTED:kotlin.Int),[android.media.tv.ad.TvAdManager#ERROR_WEAK_SIGNAL](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdManager#ERROR_WEAK_SIGNAL:kotlin.Int),[android.media.tv.ad.TvAdManager#ERROR_RESOURCE_UNAVAILABLE](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdManager#ERROR_RESOURCE_UNAVAILABLE:kotlin.Int),[android.media.tv.ad.TvAdManager#ERROR_BLOCKED](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdManager#ERROR_BLOCKED:kotlin.Int),[android.media.tv.ad.TvAdManager#ERROR_ENCRYPTED](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdManager#ERROR_ENCRYPTED:kotlin.Int), or[android.media.tv.ad.TvAdManager#ERROR_UNKNOWN_CHANNEL](https://developer.android.com/reference/kotlin/android/media/tv/ad/TvAdManager#ERROR_UNKNOWN_CHANNEL:kotlin.Int) |