Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#pubctors) \| [Methods](https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#inhmethods)

# TvInteractiveAppService.Session

*** ** * ** ***

` public static abstract class TvInteractiveAppService.Session `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/android/view/KeyEvent.Callback `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.media.tv.interactive.TvInteractiveAppService.Session |

<br />

*** ** * ** ***

Base class for derived classes to implement to provide a TV interactive app session.

A session is associated with a `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppView` instance and handles corresponding communications. It also handles the communications with `https://developer.android.com/reference/android/media/tv/TvInputService.Session` if connected.
**See also:**

- `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppView#setTvView(android.media.tv.TvView)`

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#Session(android.content.Context)(https://developer.android.com/reference/android/content/Context context) ` Creates a new Session. |

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#isMediaViewEnabled()() ` Returns `true` if media view is enabled, `false` otherwise. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#layoutSurface(int,%20int,%20int,%20int)(int left, int top, int right, int bottom) ` Assigns a size and position to the surface passed in `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onSetSurface(android.view.Surface)`. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#notifyAdBufferReady(android.media.tv.AdBuffer)(https://developer.android.com/reference/android/media/tv/AdBuffer buffer) ` Notifies when the advertisement buffer is filled and ready to be read. |
| ` final void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#notifyBiInteractiveAppCreated(android.net.Uri,%20java.lang.String)(https://developer.android.com/reference/android/net/Uri biIAppUri, https://developer.android.com/reference/java/lang/String biIAppId) ` Notifies the broadcast-independent(BI) interactive application has been created. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#notifySessionStateChanged(int,%20int)(int state, int err) ` Notifies when the session state is changed. |
| ` final void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#notifyTeletextAppStateChanged(int)(int state) ` Notifies when the digital teletext app state is changed. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onAdBufferConsumed(android.media.tv.AdBuffer)(https://developer.android.com/reference/android/media/tv/AdBuffer buffer) ` Called when an advertisement buffer is consumed. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onAdResponse(android.media.tv.AdResponse)(https://developer.android.com/reference/android/media/tv/AdResponse response) ` Called when an advertisement response is received. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onAvailableSpeeds(float[])(float[] speeds) ` Receives available playback speeds. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onBroadcastInfoResponse(android.media.tv.BroadcastInfoResponse)(https://developer.android.com/reference/android/media/tv/BroadcastInfoResponse response) ` Called when a broadcast info response is received. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onCertificate(java.lang.String,%20int,%20android.net.http.SslCertificate)(https://developer.android.com/reference/java/lang/String host, int port, https://developer.android.com/reference/android/net/http/SslCertificate cert) ` Receives the requested Certificate |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onContentAllowed()() ` Called when content is allowed. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onContentBlocked(android.media.tv.TvContentRating)(https://developer.android.com/reference/android/media/tv/TvContentRating rating) ` Called when content is blocked. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onCreateBiInteractiveAppRequest(android.net.Uri,%20android.os.Bundle)(https://developer.android.com/reference/android/net/Uri biIAppUri, https://developer.android.com/reference/android/os/Bundle params) ` Creates broadcast-independent(BI) interactive application. |
| ` https://developer.android.com/reference/android/view/View` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onCreateMediaView()() ` Called when the application requests to create an media view. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onCurrentChannelLcn(int)(int lcn) ` Receives logical channel number (LCN) of current channel. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onCurrentChannelUri(android.net.Uri)(https://developer.android.com/reference/android/net/Uri channelUri) ` Receives current channel URI. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onCurrentTvInputId(java.lang.String)(https://developer.android.com/reference/java/lang/String inputId) ` Receives current TV input ID. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onCurrentVideoBounds(android.graphics.Rect)(https://developer.android.com/reference/android/graphics/Rect bounds) ` Receives current video bounds. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onDestroyBiInteractiveAppRequest(java.lang.String)(https://developer.android.com/reference/java/lang/String biIAppId) ` Destroys broadcast-independent(BI) interactive application. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onError(java.lang.String,%20android.os.Bundle)(https://developer.android.com/reference/java/lang/String errMsg, https://developer.android.com/reference/android/os/Bundle params) ` Called when the application sends information of an error. |
| ` boolean` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onGenericMotionEvent(android.view.MotionEvent)(https://developer.android.com/reference/android/view/MotionEvent event) ` Implement this method to handle generic motion events on the current session. |
| ` boolean` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onKeyDown(int,%20android.view.KeyEvent)(int keyCode, https://developer.android.com/reference/android/view/KeyEvent event) ` Called when a key down event has occurred. |
| ` boolean` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onKeyLongPress(int,%20android.view.KeyEvent)(int keyCode, https://developer.android.com/reference/android/view/KeyEvent event) ` Called when a long press has occurred. |
| ` boolean` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onKeyMultiple(int,%20int,%20android.view.KeyEvent)(int keyCode, int count, https://developer.android.com/reference/android/view/KeyEvent event) ` Called when a user's interaction with an analog control, such as flinging a trackball, generates simulated down/up events for the same key multiple times in quick succession. |
| ` boolean` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onKeyUp(int,%20android.view.KeyEvent)(int keyCode, https://developer.android.com/reference/android/view/KeyEvent event) ` Called when a key up event has occurred. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onMediaViewSizeChanged(int,%20int)(int width, int height) ` Called when the size of the media view is changed by the application. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onRecordingConnectionFailed(java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String recordingId, https://developer.android.com/reference/java/lang/String inputId) ` This is called when an error occurred while establishing a connection to the recording session for the corresponding TV input. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onRecordingDisconnected(java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String recordingId, https://developer.android.com/reference/java/lang/String inputId) ` This is called when the connection to the current recording session is lost. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onRecordingError(java.lang.String,%20int)(https://developer.android.com/reference/java/lang/String recordingId, int err) ` This is called when an issue has occurred. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onRecordingScheduled(java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String recordingId, https://developer.android.com/reference/java/lang/String requestId) ` This is called when the recording has been scheduled. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onRecordingStarted(java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String recordingId, https://developer.android.com/reference/java/lang/String requestId) ` This is called when a recording has been started. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onRecordingStopped(java.lang.String)(https://developer.android.com/reference/java/lang/String recordingId) ` This is called when the recording has been stopped. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onRecordingTuned(java.lang.String,%20android.net.Uri)(https://developer.android.com/reference/java/lang/String recordingId, https://developer.android.com/reference/android/net/Uri channelUri) ` This is called when the recording session has been tuned to the given channel and is ready to start recording. |
| ` abstract void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onRelease()() ` Releases TvInteractiveAppService session. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onResetInteractiveApp()() ` Resets TvInteractiveAppService session. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onSelectedTrackInfo(java.util.List<android.media.tv.TvTrackInfo>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/media/tv/TvTrackInfo> tracks) ` Called when the TV App sends the selected track info as a response to `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestSelectedTrackInfo()`. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onSetSurface(android.view.Surface)(https://developer.android.com/reference/android/view/Surface surface) ` Called when the application sets the surface. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onSetTeletextAppEnabled(boolean)(boolean enable) ` To toggle Digital Teletext Application if there is one in AIT app list. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onSignalStrength(int)(int strength) ` Called when signal strength is changed. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onSigningResult(java.lang.String,%20byte[])(https://developer.android.com/reference/java/lang/String signingId, byte[] result) ` Receives signing result. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onStartInteractiveApp()() ` Starts TvInteractiveAppService session. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onStopInteractiveApp()() ` Stops TvInteractiveAppService session. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onStreamVolume(float)(float volume) ` Receives current stream volume. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onSurfaceChanged(int,%20int,%20int)(int format, int width, int height) ` Called after any structural changes (format or size) have been made to the surface passed in `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onSetSurface(android.view.Surface)`. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onTimeShiftCurrentPositionChanged(java.lang.String,%20long)(https://developer.android.com/reference/java/lang/String inputId, long timeMs) ` Called when time shift current position is changed. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onTimeShiftMode(int)(int mode) ` Receives current time shift mode. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onTimeShiftPlaybackParams(android.media.PlaybackParams)(https://developer.android.com/reference/android/media/PlaybackParams params) ` Called when the time shift `https://developer.android.com/reference/android/media/PlaybackParams` is set or changed. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onTimeShiftStartPositionChanged(java.lang.String,%20long)(https://developer.android.com/reference/java/lang/String inputId, long timeMs) ` Called when time shift start position is changed. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onTimeShiftStatusChanged(java.lang.String,%20int)(https://developer.android.com/reference/java/lang/String inputId, int status) ` Called when time shift status is changed. |
| ` boolean` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onTouchEvent(android.view.MotionEvent)(https://developer.android.com/reference/android/view/MotionEvent event) ` Implement this method to handle touch screen motion events on the current session. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onTrackInfoList(java.util.List<android.media.tv.TvTrackInfo>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/media/tv/TvTrackInfo> tracks) ` Receives track list. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onTrackSelected(int,%20java.lang.String)(int type, https://developer.android.com/reference/java/lang/String trackId) ` Called when the corresponding TV input selected to a track. |
| ` boolean` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onTrackballEvent(android.view.MotionEvent)(https://developer.android.com/reference/android/view/MotionEvent event) ` Implement this method to handle trackball events on the current session. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onTracksChanged(java.util.List<android.media.tv.TvTrackInfo>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/media/tv/TvTrackInfo> tracks) ` Called when the tracks are changed. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onTuned(android.net.Uri)(https://developer.android.com/reference/android/net/Uri channelUri) ` Called when the corresponding TV input tuned to a channel. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onTvMessage(int,%20android.os.Bundle)(int type, https://developer.android.com/reference/android/os/Bundle data) ` Called when a TV message is received |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onTvRecordingInfo(android.media.tv.TvRecordingInfo)(https://developer.android.com/reference/android/media/tv/TvRecordingInfo recordingInfo) ` Receives the requested `https://developer.android.com/reference/android/media/tv/TvRecordingInfo`. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onTvRecordingInfoList(java.util.List<android.media.tv.TvRecordingInfo>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/media/tv/TvRecordingInfo> recordingInfoList) ` Receives requested recording info list. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onVideoAvailable()() ` Called when video is available. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onVideoFreezeUpdated(boolean)(boolean isFrozen) ` Called when video becomes frozen or unfrozen. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onVideoUnavailable(int)(int reason) ` Called when video is unavailable. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#removeBroadcastInfo(int)(int requestId) ` Remove broadcast information request from the related TV input. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestAd(android.media.tv.AdRequest)(https://developer.android.com/reference/android/media/tv/AdRequest request) ` Sends an advertisement request to be processed by the related TV input. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestAvailableSpeeds()() ` Requests available speeds for time shift. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestBroadcastInfo(android.media.tv.BroadcastInfoRequest)(https://developer.android.com/reference/android/media/tv/BroadcastInfoRequest request) ` Requests broadcast related information from the related TV input. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestCertificate(java.lang.String,%20int)(https://developer.android.com/reference/java/lang/String host, int port) ` Requests a SSL certificate for client validation. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestCurrentChannelLcn()() ` Requests the logic channel number (LCN) of the current channel. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestCurrentChannelUri()() ` Requests the URI of the current channel. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestCurrentTvInputId()() ` Requests current TV input ID. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestCurrentVideoBounds()() ` Requests the bounds of the current video. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestScheduleRecording(java.lang.String,%20java.lang.String,%20android.net.Uri,%20android.net.Uri,%20android.os.Bundle)(https://developer.android.com/reference/java/lang/String requestId, https://developer.android.com/reference/java/lang/String inputId, https://developer.android.com/reference/android/net/Uri channelUri, https://developer.android.com/reference/android/net/Uri programUri, https://developer.android.com/reference/android/os/Bundle params) ` Requests scheduling of a recording. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestScheduleRecording(java.lang.String,%20java.lang.String,%20android.net.Uri,%20long,%20long,%20int,%20android.os.Bundle)(https://developer.android.com/reference/java/lang/String requestId, https://developer.android.com/reference/java/lang/String inputId, https://developer.android.com/reference/android/net/Uri channelUri, long startTime, long duration, int repeatDays, https://developer.android.com/reference/android/os/Bundle params) ` Requests scheduling of a recording. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestSelectedTrackInfo()() ` Requests a list of the currently selected `https://developer.android.com/reference/android/media/tv/TvTrackInfo` from the TV App. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestSigning(java.lang.String,%20java.lang.String,%20java.lang.String,%20byte[])(https://developer.android.com/reference/java/lang/String signingId, https://developer.android.com/reference/java/lang/String algorithm, https://developer.android.com/reference/java/lang/String alias, byte[] data) ` Requests signing of the given data. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestSigning(java.lang.String,%20java.lang.String,%20java.lang.String,%20int,%20byte[])(https://developer.android.com/reference/java/lang/String signingId, https://developer.android.com/reference/java/lang/String algorithm, https://developer.android.com/reference/java/lang/String host, int port, byte[] data) ` Requests signing of the given data. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestStartRecording(java.lang.String,%20android.net.Uri)(https://developer.android.com/reference/java/lang/String requestId, https://developer.android.com/reference/android/net/Uri programUri) ` Requests starting of recording This is used to request the active `https://developer.android.com/reference/android/media/tv/TvRecordingClient` to call `https://developer.android.com/reference/android/media/tv/TvRecordingClient#startRecording(android.net.Uri)` with the provided `programUri`. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestStopRecording(java.lang.String)(https://developer.android.com/reference/java/lang/String recordingId) ` Requests the recording associated with the recordingId to stop. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestStreamVolume()() ` Requests stream volume. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestTimeShiftMode()() ` Requests time shift mode. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestTrackInfoList()() ` Requests the list of `https://developer.android.com/reference/android/media/tv/TvTrackInfo`. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestTvRecordingInfo(java.lang.String)(https://developer.android.com/reference/java/lang/String recordingId) ` Gets the recording info for the specified recording. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestTvRecordingInfoList(int)(int type) ` Gets a list of `https://developer.android.com/reference/android/media/tv/TvRecordingInfo` for the specified recording type. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#sendPlaybackCommandRequest(java.lang.String,%20android.os.Bundle)(https://developer.android.com/reference/java/lang/String cmdType, https://developer.android.com/reference/android/os/Bundle parameters) ` Sends a specific playback command to be processed by the related TV input. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#sendTimeShiftCommandRequest(java.lang.String,%20android.os.Bundle)(https://developer.android.com/reference/java/lang/String cmdType, https://developer.android.com/reference/android/os/Bundle parameters) ` Sends a specific time shift command to be processed by the related TV input. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#setMediaViewEnabled(boolean)(boolean enable) ` Enables or disables the media view. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#setTvRecordingInfo(java.lang.String,%20android.media.tv.TvRecordingInfo)(https://developer.android.com/reference/java/lang/String recordingId, https://developer.android.com/reference/android/media/tv/TvRecordingInfo recordingInfo) ` Sets the recording info for the specified recording. |
| ` void` | ` https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#setVideoBounds(android.graphics.Rect)(https://developer.android.com/reference/android/graphics/Rect rect) ` Sets broadcast video bounds. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
From interface ` https://developer.android.com/reference/android/view/KeyEvent.Callback ` ` abstract boolean` ` https://developer.android.com/reference/android/view/KeyEvent.Callback#onKeyDown(int,%20android.view.KeyEvent)(int keyCode, https://developer.android.com/reference/android/view/KeyEvent event) `

Called when a key down event has occurred.
` abstract boolean` ` https://developer.android.com/reference/android/view/KeyEvent.Callback#onKeyLongPress(int,%20android.view.KeyEvent)(int keyCode, https://developer.android.com/reference/android/view/KeyEvent event) `

Called when a long press has occurred.
` abstract boolean` ` https://developer.android.com/reference/android/view/KeyEvent.Callback#onKeyMultiple(int,%20int,%20android.view.KeyEvent)(int keyCode, int count, https://developer.android.com/reference/android/view/KeyEvent event) `

Called when a user's interaction with an analog control, such as flinging a trackball, generates simulated down/up events for the same key multiple times in quick succession.
` abstract boolean` ` https://developer.android.com/reference/android/view/KeyEvent.Callback#onKeyUp(int,%20android.view.KeyEvent)(int keyCode, https://developer.android.com/reference/android/view/KeyEvent event) `

Called when a key up event has occurred.

## Public constructors

### Session

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

```
public Session (Context context)
```

Creates a new Session.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: The context of the application. This value cannot be `null`. <br /> |

## Public methods

### isMediaViewEnabled

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

```
public boolean isMediaViewEnabled ()
```

Returns `true` if media view is enabled, `false` otherwise.

<br />

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

**See also:**

- `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#setMediaViewEnabled(boolean)`

### layoutSurface

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

```
public void layoutSurface (int left, 
                int top, 
                int right, 
                int bottom)
```

Assigns a size and position to the surface passed in `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onSetSurface(android.view.Surface)`. The position is relative to the overlay view that sits on top of this surface.   

If you override this method you *must* call through to the superclass implementation.

<br />

| Parameters ||
|---|---|
| `left` | `int`: Left position in pixels, relative to the overlay view. <br /> |
| `top` | `int`: Top position in pixels, relative to the overlay view. <br /> |
| `right` | `int`: Right position in pixels, relative to the overlay view. <br /> |
| `bottom` | `int`: Bottom position in pixels, relative to the overlay view. <br /> |

### notifyAdBufferReady

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

```
public void notifyAdBufferReady (AdBuffer buffer)
```

Notifies when the advertisement buffer is filled and ready to be read.   

If you override this method you *must* call through to the superclass implementation.

<br />

| Parameters ||
|---|---|
| `buffer` | `AdBuffer`: The `https://developer.android.com/reference/android/media/tv/AdBuffer` to be received. This value cannot be `null`. <br /> |

### notifyBiInteractiveAppCreated

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

```
public final void notifyBiInteractiveAppCreated (Uri biIAppUri, 
                String biIAppId)
```

Notifies the broadcast-independent(BI) interactive application has been created.   

If you override this method you *must* call through to the superclass implementation.

<br />

| Parameters ||
|---|---|
| `biIAppUri` | `Uri`: This value cannot be `null`. <br /> |
| `biIAppId` | `String`: BI interactive app ID, which can be used to destroy the BI interactive app. `null` if it's not created successfully. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onCreateBiInteractiveAppRequest(android.net.Uri,%20android.os.Bundle)`

### notifySessionStateChanged

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

```
public void notifySessionStateChanged (int state, 
                int err)
```

Notifies when the session state is changed.   

If you override this method you *must* call through to the superclass implementation.

<br />

| Parameters ||
|---|---|
| `state` | `int`: the current session state. Value is one of the following: - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppManager#INTERACTIVE_APP_STATE_STOPPED` - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppManager#INTERACTIVE_APP_STATE_RUNNING` - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppManager#INTERACTIVE_APP_STATE_ERROR` |
| `err` | `int`: the error code for error state. `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppManager#ERROR_NONE` is used when the state is not `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppManager#INTERACTIVE_APP_STATE_ERROR`. Value is one of the following: - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppManager#ERROR_NONE` - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppManager#ERROR_UNKNOWN` - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppManager#ERROR_NOT_SUPPORTED` - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppManager#ERROR_WEAK_SIGNAL` - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppManager#ERROR_RESOURCE_UNAVAILABLE` - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppManager#ERROR_BLOCKED` - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppManager#ERROR_ENCRYPTED` - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppManager#ERROR_UNKNOWN_CHANNEL` |

### notifyTeletextAppStateChanged

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

```
public final void notifyTeletextAppStateChanged (int state)
```

Notifies when the digital teletext app state is changed.   

If you override this method you *must* call through to the superclass implementation.

<br />

| Parameters ||
|---|---|
| `state` | `int`: the current state. Value is one of the following: - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppManager#TELETEXT_APP_STATE_SHOW` - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppManager#TELETEXT_APP_STATE_HIDE` - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppManager#TELETEXT_APP_STATE_ERROR` |

### onAdBufferConsumed

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

```
public void onAdBufferConsumed (AdBuffer buffer)
```

Called when an advertisement buffer is consumed.

<br />

| Parameters ||
|---|---|
| `buffer` | `AdBuffer`: The `https://developer.android.com/reference/android/media/tv/AdBuffer` that was consumed. This value cannot be `null`. <br /> |

### onAdResponse

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

```
public void onAdResponse (AdResponse response)
```

Called when an advertisement response is received.

<br />

| Parameters ||
|---|---|
| `response` | `AdResponse`: This value cannot be `null`. <br /> |

### onAvailableSpeeds

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

```
public void onAvailableSpeeds (float[] speeds)
```

Receives available playback speeds.

<br />

| Parameters ||
|---|---|
| `speeds` | `float`: An ordered array of playback speeds, expressed as values relative to the normal playback speed (1.0), at which the current content can be played as a time-shifted broadcast. This is an empty array if the supported playback speeds are unknown or the video/broadcast is not in time shift mode. If currently in time shift mode, this array will normally include at least the values 1.0 (normal speed) and 0.0 (paused). This value cannot be `null`. <br /> |

### onBroadcastInfoResponse

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

```
public void onBroadcastInfoResponse (BroadcastInfoResponse response)
```

Called when a broadcast info response is received.

<br />

| Parameters ||
|---|---|
| `response` | `BroadcastInfoResponse`: This value cannot be `null`. <br /> |

### onCertificate

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

```
public void onCertificate (String host, 
                int port, 
                SslCertificate cert)
```

Receives the requested Certificate

<br />

| Parameters ||
|---|---|
| `host` | `String`: the host name of the SSL authentication server. This value cannot be `null`. <br /> |
| `port` | `int`: the port of the SSL authentication server. E.g., 443 <br /> |
| `cert` | `SslCertificate`: the SSL certificate received. This value cannot be `null`. <br /> |

### onContentAllowed

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

```
public void onContentAllowed ()
```

Called when content is allowed.

<br />

### onContentBlocked

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

```
public void onContentBlocked (TvContentRating rating)
```

Called when content is blocked.

<br />

| Parameters ||
|---|---|
| `rating` | `TvContentRating`: This value cannot be `null`. <br /> |

### onCreateBiInteractiveAppRequest

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

```
public void onCreateBiInteractiveAppRequest (Uri biIAppUri, 
                Bundle params)
```

Creates broadcast-independent(BI) interactive application.

The implementation should call `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#notifyBiInteractiveAppCreated(android.net.Uri,%20java.lang.String)`, no matter if it's created successfully or not.

<br />

| Parameters ||
|---|---|
| `biIAppUri` | `Uri`: This value cannot be `null`. <br /> |
| `params` | `Bundle`: This value may be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#notifyBiInteractiveAppCreated(android.net.Uri,%20java.lang.String)`
- `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onDestroyBiInteractiveAppRequest(java.lang.String)`

### onCreateMediaView

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

```
public View onCreateMediaView ()
```

Called when the application requests to create an media view. Each session implementation can override this method and return its own view.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/View` | a view attached to the media window. This value may be `null`. <br /> |

### onCurrentChannelLcn

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

```
public void onCurrentChannelLcn (int lcn)
```

Receives logical channel number (LCN) of current channel.

<br />

| Parameters ||
|---|---|
| `lcn` | `int` <br /> |

### onCurrentChannelUri

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

```
public void onCurrentChannelUri (Uri channelUri)
```

Receives current channel URI.

<br />

| Parameters ||
|---|---|
| `channelUri` | `Uri`: This value may be `null`. <br /> |

### onCurrentTvInputId

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

```
public void onCurrentTvInputId (String inputId)
```

Receives current TV input ID.

<br />

| Parameters ||
|---|---|
| `inputId` | `String`: This value may be `null`. <br /> |

### onCurrentVideoBounds

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

```
public void onCurrentVideoBounds (Rect bounds)
```

Receives current video bounds.

<br />

| Parameters ||
|---|---|
| `bounds` | `Rect`: the rectangle area for rendering the current video. This value cannot be `null`. <br /> |

### onDestroyBiInteractiveAppRequest

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

```
public void onDestroyBiInteractiveAppRequest (String biIAppId)
```

Destroys broadcast-independent(BI) interactive application.

<br />

| Parameters ||
|---|---|
| `biIAppId` | `String`: the BI interactive app ID from `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onCreateBiInteractiveAppRequest(android.net.Uri,%20android.os.Bundle)` This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onCreateBiInteractiveAppRequest(android.net.Uri,%20android.os.Bundle)`

### onError

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

```
public void onError (String errMsg, 
                Bundle params)
```

Called when the application sends information of an error.

<br />

| Parameters ||
|---|---|
| `errMsg` | `String`: the message of the error. This value cannot be `null`. <br /> |
| `params` | `Bundle`: additional parameters of the error. For example, the signingId of `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppView.TvInteractiveAppCallback#onRequestSigning(java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20byte[])` can be included to identify the related signing request, and the method name "onRequestSigning" can also be added to the params. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppView#ERROR_KEY_METHOD_NAME`

### onGenericMotionEvent

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

```
public boolean onGenericMotionEvent (MotionEvent event)
```

Implement this method to handle generic motion events on the current session.

<br />

| Parameters ||
|---|---|
| `event` | `MotionEvent`: The motion event being received. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | If you handled the event, return `true`. If you want to allow the event to be handled by the next receiver, return `false`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/View#onGenericMotionEvent(android.view.MotionEvent)`

### onKeyDown

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

```
public boolean onKeyDown (int keyCode, 
                KeyEvent event)
```

Called when a key down event has occurred. If you return true, you can first call `https://developer.android.com/reference/android/view/KeyEvent#startTracking()` to have the framework track the event through its `https://developer.android.com/reference/android/view/KeyEvent.Callback#onKeyUp(int,%20android.view.KeyEvent)` and also call your `https://developer.android.com/reference/android/view/KeyEvent.Callback#onKeyLongPress(int,%20android.view.KeyEvent)` if it occurs.

<br />

| Parameters ||
|---|---|
| `keyCode` | `int`: The value in event.getKeyCode(). <br /> |
| `event` | `KeyEvent`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false. <br /> |

### onKeyLongPress

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

```
public boolean onKeyLongPress (int keyCode, 
                KeyEvent event)
```

Called when a long press has occurred. If you return true, the final key up will have `https://developer.android.com/reference/android/view/KeyEvent#FLAG_CANCELED` and `https://developer.android.com/reference/android/view/KeyEvent#FLAG_CANCELED_LONG_PRESS` set. Note that in order to receive this callback, someone in the event change *must* return true from `https://developer.android.com/reference/android/view/KeyEvent.Callback#onKeyDown(int,%20android.view.KeyEvent)` *and* call `https://developer.android.com/reference/android/view/KeyEvent#startTracking()` on the event.

<br />

| Parameters ||
|---|---|
| `keyCode` | `int`: The value in event.getKeyCode(). <br /> |
| `event` | `KeyEvent`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false. <br /> |

### onKeyMultiple

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

```
public boolean onKeyMultiple (int keyCode, 
                int count, 
                KeyEvent event)
```

Called when a user's interaction with an analog control, such as flinging a trackball, generates simulated down/up events for the same key multiple times in quick succession.

<br />

| Parameters ||
|---|---|
| `keyCode` | `int`: The value in event.getKeyCode(). <br /> |
| `count` | `int`: Number of pairs as returned by event.getRepeatCount(). <br /> |
| `event` | `KeyEvent`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false. <br /> |

### onKeyUp

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

```
public boolean onKeyUp (int keyCode, 
                KeyEvent event)
```

Called when a key up event has occurred.

<br />

| Parameters ||
|---|---|
| `keyCode` | `int`: The value in event.getKeyCode(). <br /> |
| `event` | `KeyEvent`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false. <br /> |

### onMediaViewSizeChanged

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

```
public void onMediaViewSizeChanged (int width, 
                int height)
```

Called when the size of the media view is changed by the application.

This is always called at least once when the session is created regardless of whether the media view is enabled or not. The media view container size is the same as the containing `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppView`. Note that the size of the underlying surface can be different if the surface was changed by calling `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#layoutSurface(int,%20int,%20int,%20int)`.

<br />

| Parameters ||
|---|---|
| `width` | `int`: The width of the media view, in pixels. The units of this value are pixels. <br /> |
| `height` | `int`: The height of the media view, in pixels. The units of this value are pixels. <br /> |

### onRecordingConnectionFailed

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

```
public void onRecordingConnectionFailed (String recordingId, 
                String inputId)
```

This is called when an error occurred while establishing a connection to the recording session for the corresponding TV input.

<br />

| Parameters ||
|---|---|
| `recordingId` | `String`: The ID of the related recording which is sent via `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppView#notifyRecordingStarted(java.lang.String,%20java.lang.String)` This value cannot be `null`. <br /> |
| `inputId` | `String`: The ID of the TV input bound to the current TvRecordingClient. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/tv/TvRecordingClient.RecordingCallback#onConnectionFailed(java.lang.String)`

### onRecordingDisconnected

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

```
public void onRecordingDisconnected (String recordingId, 
                String inputId)
```

This is called when the connection to the current recording session is lost.

<br />

| Parameters ||
|---|---|
| `recordingId` | `String`: The ID of the related recording which is sent via `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppView#notifyRecordingStarted(java.lang.String,%20java.lang.String)` This value cannot be `null`. <br /> |
| `inputId` | `String`: The ID of the TV input bound to the current TvRecordingClient. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/tv/TvRecordingClient.RecordingCallback#onDisconnected(java.lang.String)`

### onRecordingError

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

```
public void onRecordingError (String recordingId, 
                int err)
```

This is called when an issue has occurred. It may be called at any time after the current recording session is created until it is released.

<br />

| Parameters ||
|---|---|
| `recordingId` | `String`: The ID of the related recording which is sent via `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppView#notifyRecordingStarted(java.lang.String,%20java.lang.String)` This value cannot be `null`. <br /> |
| `err` | `int`: The error code. Should be one of the following. - `https://developer.android.com/reference/android/media/tv/TvInputManager#RECORDING_ERROR_UNKNOWN` - `https://developer.android.com/reference/android/media/tv/TvInputManager#RECORDING_ERROR_INSUFFICIENT_SPACE` - `https://developer.android.com/reference/android/media/tv/TvInputManager#RECORDING_ERROR_RESOURCE_BUSY` . Value is one of the following: - `https://developer.android.com/reference/android/media/tv/TvInputManager#RECORDING_ERROR_UNKNOWN` - `https://developer.android.com/reference/android/media/tv/TvInputManager#RECORDING_ERROR_INSUFFICIENT_SPACE` - `https://developer.android.com/reference/android/media/tv/TvInputManager#RECORDING_ERROR_RESOURCE_BUSY` |

**See also:**

- `https://developer.android.com/reference/android/media/tv/TvRecordingClient.RecordingCallback#onError(int)`

### onRecordingScheduled

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

```
public void onRecordingScheduled (String recordingId, 
                String requestId)
```

This is called when the recording has been scheduled.

<br />

| Parameters ||
|---|---|
| `recordingId` | `String`: The ID assigned to this recording by the app. It can be used to send recording related requests such as `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestStopRecording(java.lang.String)`. This value cannot be `null`. <br /> |
| `requestId` | `String`: The ID of the request when `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestScheduleRecording(java.lang.String,%20java.lang.String,%20android.net.Uri,%20android.net.Uri,%20android.os.Bundle)` is called. `null` if the recording is not triggered by a request. This ID should be created by the `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService` and can be any string. <br /> |

### onRecordingStarted

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

```
public void onRecordingStarted (String recordingId, 
                String requestId)
```

This is called when a recording has been started.

When a scheduled recording is started, this is also called, and the request ID in this case is `null`.

<br />

| Parameters ||
|---|---|
| `recordingId` | `String`: The ID of the recording started. The TV app should provide and maintain this ID to identify the recording in the future. This value cannot be `null`. <br /> |
| `requestId` | `String`: The ID of the request when `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestStartRecording(java.lang.String,%20android.net.Uri)` is called. `null` if the recording is not triggered by a `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestStartRecording(java.lang.String,%20android.net.Uri)` request. This ID should be created by the `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService` and can be any string. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onRecordingStopped(java.lang.String)`

### onRecordingStopped

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

```
public void onRecordingStopped (String recordingId)
```

This is called when the recording has been stopped.

<br />

| Parameters ||
|---|---|
| `recordingId` | `String`: The ID of the recording stopped. This ID is created and maintained by the TV app when the recording was started. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onRecordingStarted(java.lang.String,%20java.lang.String)`

### onRecordingTuned

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

```
public void onRecordingTuned (String recordingId, 
                Uri channelUri)
```

This is called when the recording session has been tuned to the given channel and is ready to start recording.

<br />

| Parameters ||
|---|---|
| `recordingId` | `String`: The ID of the related recording which is sent via `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppView#notifyRecordingStarted(java.lang.String,%20java.lang.String)` This value cannot be `null`. <br /> |
| `channelUri` | `Uri`: The URI of the tuned channel. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/tv/TvRecordingClient.RecordingCallback#onTuned(android.net.Uri)`

### onRelease

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

```
public abstract void onRelease ()
```

Releases TvInteractiveAppService session.

<br />

### onResetInteractiveApp

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

```
public void onResetInteractiveApp ()
```

Resets TvInteractiveAppService session.

<br />

### onSelectedTrackInfo

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

```
public void onSelectedTrackInfo (List<TvTrackInfo> tracks)
```

Called when the TV App sends the selected track info as a response to `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestSelectedTrackInfo()`.

When a selected track changes as a result of a new selection, `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onTrackSelected(int,%20java.lang.String)` should be used instead to communicate the specific track selection.

<br />

| Parameters ||
|---|---|
| `tracks` | `List`: A list of `https://developer.android.com/reference/android/media/tv/TvTrackInfo` that are currently selected. This value cannot be `null`. <br /> |

### onSetSurface

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

```
public abstract boolean onSetSurface (Surface surface)
```

Called when the application sets the surface.

The TV Interactive App service should render interactive app UI onto the given surface. When called with `null`, the Interactive App service should immediately free any references to the currently set surface and stop using it.

<br />

| Parameters ||
|---|---|
| `surface` | `Surface`: The surface to be used for interactive app UI rendering. Can be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if the surface was set successfully, `false` otherwise. <br /> |

### onSetTeletextAppEnabled

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

```
public void onSetTeletextAppEnabled (boolean enable)
```

To toggle Digital Teletext Application if there is one in AIT app list.

<br />

| Parameters ||
|---|---|
| `enable` | `boolean`: `true` to enable teletext app; `false` otherwise. <br /> |

### onSignalStrength

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

```
public void onSignalStrength (int strength)
```

Called when signal strength is changed.

<br />

| Parameters ||
|---|---|
| `strength` | `int`: Value is one of the following: - `https://developer.android.com/reference/android/media/tv/TvInputManager#SIGNAL_STRENGTH_LOST` - `https://developer.android.com/reference/android/media/tv/TvInputManager#SIGNAL_STRENGTH_WEAK` - `https://developer.android.com/reference/android/media/tv/TvInputManager#SIGNAL_STRENGTH_STRONG` |

### onSigningResult

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

```
public void onSigningResult (String signingId, 
                byte[] result)
```

Receives signing result.

<br />

| Parameters ||
|---|---|
| `signingId` | `String`: the ID to identify the request. It's the same as the corresponding ID in `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestSigning(java.lang.String,%20java.lang.String,%20java.lang.String,%20byte[])` This value cannot be `null`. <br /> |
| `result` | `byte`: the signed result. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestSigning(java.lang.String,%20java.lang.String,%20java.lang.String,%20byte[])`

### onStartInteractiveApp

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

```
public void onStartInteractiveApp ()
```

Starts TvInteractiveAppService session.

<br />

### onStopInteractiveApp

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

```
public void onStopInteractiveApp ()
```

Stops TvInteractiveAppService session.

<br />

### onStreamVolume

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

```
public void onStreamVolume (float volume)
```

Receives current stream volume.

<br />

| Parameters ||
|---|---|
| `volume` | `float`: a volume value between `0.0f` and `1.0f`, inclusive. <br /> |

### onSurfaceChanged

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

```
public void onSurfaceChanged (int format, 
                int width, 
                int height)
```

Called after any structural changes (format or size) have been made to the surface passed in `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onSetSurface(android.view.Surface)`. This method is always called at least once, after `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onSetSurface(android.view.Surface)` is called with non-null surface.

<br />

| Parameters ||
|---|---|
| `format` | `int`: The new `https://developer.android.com/reference/android/graphics/PixelFormat` of the surface. Value is one of the following: - `https://developer.android.com/reference/android/graphics/PixelFormat#RGBA_8888` - `https://developer.android.com/reference/android/graphics/PixelFormat#RGBX_8888` - `https://developer.android.com/reference/android/graphics/PixelFormat#RGBA_F16` - `https://developer.android.com/reference/android/graphics/PixelFormat#RGBA_1010102` - `https://developer.android.com/reference/android/graphics/PixelFormat#RGB_888` - `https://developer.android.com/reference/android/graphics/PixelFormat#RGB_565` |
| `width` | `int`: The new width of the surface. <br /> |
| `height` | `int`: The new height of the surface. <br /> |

### onTimeShiftCurrentPositionChanged

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

```
public void onTimeShiftCurrentPositionChanged (String inputId, 
                long timeMs)
```

Called when time shift current position is changed.

<br />

| Parameters ||
|---|---|
| `inputId` | `String`: The ID of the input for which the time shift current position has changed. This value cannot be `null`. <br /> |
| `timeMs` | `long`: The current position for time shifting, in milliseconds since the epoch. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/tv/TvView.TimeShiftPositionCallback#onTimeShiftCurrentPositionChanged(java.lang.String,%20long)`

### onTimeShiftMode

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

```
public void onTimeShiftMode (int mode)
```

Receives current time shift mode.

<br />

| Parameters ||
|---|---|
| `mode` | `int`: The current time shift mode. The value is one of the following: `https://developer.android.com/reference/android/media/tv/TvInputManager#TIME_SHIFT_MODE_OFF`, `https://developer.android.com/reference/android/media/tv/TvInputManager#TIME_SHIFT_MODE_LOCAL`, `https://developer.android.com/reference/android/media/tv/TvInputManager#TIME_SHIFT_MODE_NETWORK`, `https://developer.android.com/reference/android/media/tv/TvInputManager#TIME_SHIFT_MODE_AUTO`. Value is one of the following: - `https://developer.android.com/reference/android/media/tv/TvInputManager#TIME_SHIFT_MODE_OFF` - `https://developer.android.com/reference/android/media/tv/TvInputManager#TIME_SHIFT_MODE_LOCAL` - `https://developer.android.com/reference/android/media/tv/TvInputManager#TIME_SHIFT_MODE_NETWORK` - `https://developer.android.com/reference/android/media/tv/TvInputManager#TIME_SHIFT_MODE_AUTO` |

### onTimeShiftPlaybackParams

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

```
public void onTimeShiftPlaybackParams (PlaybackParams params)
```

Called when the time shift `https://developer.android.com/reference/android/media/PlaybackParams` is set or changed.

<br />

| Parameters ||
|---|---|
| `params` | `PlaybackParams`: The new `https://developer.android.com/reference/android/media/PlaybackParams` that was set or changed. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/tv/TvView#timeShiftSetPlaybackParams(android.media.PlaybackParams)`

### onTimeShiftStartPositionChanged

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

```
public void onTimeShiftStartPositionChanged (String inputId, 
                long timeMs)
```

Called when time shift start position is changed.

<br />

| Parameters ||
|---|---|
| `inputId` | `String`: The ID of the input for which the time shift start position has changed. This value cannot be `null`. <br /> |
| `timeMs` | `long`: The start position for time shifting, in milliseconds since the epoch. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/tv/TvView.TimeShiftPositionCallback#onTimeShiftStartPositionChanged(java.lang.String,%20long)`

### onTimeShiftStatusChanged

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

```
public void onTimeShiftStatusChanged (String inputId, 
                int status)
```

Called when time shift status is changed.

<br />

| Parameters ||
|---|---|
| `inputId` | `String`: The ID of the input for which the time shift status has changed. This value cannot be `null`. <br /> |
| `status` | `int`: The status of which the input has changed to. Should be one of the following. - `https://developer.android.com/reference/android/media/tv/TvInputManager#TIME_SHIFT_STATUS_UNKNOWN` - `https://developer.android.com/reference/android/media/tv/TvInputManager#TIME_SHIFT_STATUS_UNSUPPORTED` - `https://developer.android.com/reference/android/media/tv/TvInputManager#TIME_SHIFT_STATUS_UNAVAILABLE` - `https://developer.android.com/reference/android/media/tv/TvInputManager#TIME_SHIFT_STATUS_AVAILABLE` . Value is one of the following: - `https://developer.android.com/reference/android/media/tv/TvInputManager#TIME_SHIFT_STATUS_UNKNOWN` - `https://developer.android.com/reference/android/media/tv/TvInputManager#TIME_SHIFT_STATUS_UNSUPPORTED` - `https://developer.android.com/reference/android/media/tv/TvInputManager#TIME_SHIFT_STATUS_UNAVAILABLE` - `https://developer.android.com/reference/android/media/tv/TvInputManager#TIME_SHIFT_STATUS_AVAILABLE` |

**See also:**

- `https://developer.android.com/reference/android/media/tv/TvView.TvInputCallback#onTimeShiftStatusChanged(java.lang.String,%20int)`
- `https://developer.android.com/reference/android/media/tv/TvInputService.Session#notifyTimeShiftStatusChanged(int)`

### onTouchEvent

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

```
public boolean onTouchEvent (MotionEvent event)
```

Implement this method to handle touch screen motion events on the current session.

<br />

| Parameters ||
|---|---|
| `event` | `MotionEvent`: The motion event being received. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | If you handled the event, return `true`. If you want to allow the event to be handled by the next receiver, return `false`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/View#onTouchEvent(android.view.MotionEvent)`

### onTrackInfoList

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

```
public void onTrackInfoList (List<TvTrackInfo> tracks)
```

Receives track list.

<br />

| Parameters ||
|---|---|
| `tracks` | `List`: This value cannot be `null`. <br /> |

### onTrackSelected

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

```
public void onTrackSelected (int type, 
                String trackId)
```

Called when the corresponding TV input selected to a track. If the track is deselected and no track is currently selected, trackId is an empty string.

<br />

| Parameters ||
|---|---|
| `type` | `int`: Value is one of the following: - `https://developer.android.com/reference/android/media/tv/TvTrackInfo#TYPE_AUDIO` - `https://developer.android.com/reference/android/media/tv/TvTrackInfo#TYPE_VIDEO` - `https://developer.android.com/reference/android/media/tv/TvTrackInfo#TYPE_SUBTITLE` |
| `trackId` | `String`: This value cannot be `null`. <br /> |

### onTrackballEvent

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

```
public boolean onTrackballEvent (MotionEvent event)
```

Implement this method to handle trackball events on the current session.

<br />

| Parameters ||
|---|---|
| `event` | `MotionEvent`: The motion event being received. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | If you handled the event, return `true`. If you want to allow the event to be handled by the next receiver, return `false`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/View#onTrackballEvent(android.view.MotionEvent)`

### onTracksChanged

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

```
public void onTracksChanged (List<TvTrackInfo> tracks)
```

Called when the tracks are changed.

<br />

| Parameters ||
|---|---|
| `tracks` | `List`: This value cannot be `null`. <br /> |

### onTuned

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

```
public void onTuned (Uri channelUri)
```

Called when the corresponding TV input tuned to a channel.

<br />

| Parameters ||
|---|---|
| `channelUri` | `Uri`: The tuned channel URI. This value cannot be `null`. <br /> |

### onTvMessage

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

```
public void onTvMessage (int type, 
                Bundle data)
```

Called when a TV message is received

<br />

| Parameters ||
|---|---|
| `type` | `int`: The type of message received, such as `https://developer.android.com/reference/android/media/tv/TvInputManager#TV_MESSAGE_TYPE_WATERMARK` Value is one of the following: - `https://developer.android.com/reference/android/media/tv/TvInputManager#TV_MESSAGE_TYPE_WATERMARK` - `https://developer.android.com/reference/android/media/tv/TvInputManager#TV_MESSAGE_TYPE_CLOSED_CAPTION` - `https://developer.android.com/reference/android/media/tv/TvInputManager#TV_MESSAGE_TYPE_OTHER` |
| `data` | `Bundle`: The raw data of the message. The bundle keys are: `https://developer.android.com/reference/android/media/tv/TvInputManager#TV_MESSAGE_KEY_STREAM_ID`, `https://developer.android.com/reference/android/media/tv/TvInputManager#TV_MESSAGE_KEY_GROUP_ID`, `https://developer.android.com/reference/android/media/tv/TvInputManager#TV_MESSAGE_KEY_SUBTYPE`, `https://developer.android.com/reference/android/media/tv/TvInputManager#TV_MESSAGE_KEY_RAW_DATA`. See `https://developer.android.com/reference/android/media/tv/TvInputManager#TV_MESSAGE_KEY_SUBTYPE` for more information on how to parse this data. This value cannot be `null`. <br /> |

### onTvRecordingInfo

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

```
public void onTvRecordingInfo (TvRecordingInfo recordingInfo)
```

Receives the requested `https://developer.android.com/reference/android/media/tv/TvRecordingInfo`.

<br />

| Parameters ||
|---|---|
| `recordingInfo` | `TvRecordingInfo`: The requested recording info. `null` if no recording found. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestTvRecordingInfo(java.lang.String)`

### onTvRecordingInfoList

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

```
public void onTvRecordingInfoList (List<TvRecordingInfo> recordingInfoList)
```

Receives requested recording info list.

<br />

| Parameters ||
|---|---|
| `recordingInfoList` | `List`: The list of recording info requested. Returns an empty list if no matching recording info found. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#requestTvRecordingInfoList(int)`

### onVideoAvailable

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

```
public void onVideoAvailable ()
```

Called when video is available.

<br />

### onVideoFreezeUpdated

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

```
public void onVideoFreezeUpdated (boolean isFrozen)
```

Called when video becomes frozen or unfrozen. Audio playback will continue while video will be frozen to the last frame if `true`.

<br />

| Parameters ||
|---|---|
| `isFrozen` | `boolean`: Whether or not the video is frozen. <br /> |

### onVideoUnavailable

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

```
public void onVideoUnavailable (int reason)
```

Called when video is unavailable.

<br />

| Parameters ||
|---|---|
| `reason` | `int`: Value is one of the following: - `https://developer.android.com/reference/android/media/tv/TvInputManager#VIDEO_UNAVAILABLE_REASON_UNKNOWN` - `https://developer.android.com/reference/android/media/tv/TvInputManager#VIDEO_UNAVAILABLE_REASON_TUNING` - `https://developer.android.com/reference/android/media/tv/TvInputManager#VIDEO_UNAVAILABLE_REASON_WEAK_SIGNAL` - `https://developer.android.com/reference/android/media/tv/TvInputManager#VIDEO_UNAVAILABLE_REASON_BUFFERING` - `https://developer.android.com/reference/android/media/tv/TvInputManager#VIDEO_UNAVAILABLE_REASON_AUDIO_ONLY` - `https://developer.android.com/reference/android/media/tv/TvInputManager#VIDEO_UNAVAILABLE_REASON_NOT_CONNECTED` - `https://developer.android.com/reference/android/media/tv/TvInputManager#VIDEO_UNAVAILABLE_REASON_INSUFFICIENT_RESOURCE` - `https://developer.android.com/reference/android/media/tv/TvInputManager#VIDEO_UNAVAILABLE_REASON_CAS_INSUFFICIENT_OUTPUT_PROTECTION` - `https://developer.android.com/reference/android/media/tv/TvInputManager#VIDEO_UNAVAILABLE_REASON_CAS_PVR_RECORDING_NOT_ALLOWED` - `https://developer.android.com/reference/android/media/tv/TvInputManager#VIDEO_UNAVAILABLE_REASON_CAS_LICENSE_EXPIRED` - `https://developer.android.com/reference/android/media/tv/TvInputManager#VIDEO_UNAVAILABLE_REASON_CAS_NEED_ACTIVATION` - `https://developer.android.com/reference/android/media/tv/TvInputManager#VIDEO_UNAVAILABLE_REASON_CAS_NEED_PAIRING` - `https://developer.android.com/reference/android/media/tv/TvInputManager#VIDEO_UNAVAILABLE_REASON_CAS_NO_CARD` - `https://developer.android.com/reference/android/media/tv/TvInputManager#VIDEO_UNAVAILABLE_REASON_CAS_CARD_MUTE` - `https://developer.android.com/reference/android/media/tv/TvInputManager#VIDEO_UNAVAILABLE_REASON_CAS_CARD_INVALID` - `https://developer.android.com/reference/android/media/tv/TvInputManager#VIDEO_UNAVAILABLE_REASON_CAS_BLACKOUT` - `https://developer.android.com/reference/android/media/tv/TvInputManager#VIDEO_UNAVAILABLE_REASON_CAS_REBOOTING` - `https://developer.android.com/reference/android/media/tv/TvInputManager#VIDEO_UNAVAILABLE_REASON_CAS_UNKNOWN` - `https://developer.android.com/reference/android/media/tv/TvInputManager#VIDEO_UNAVAILABLE_REASON_STOPPED` |

### removeBroadcastInfo

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

```
public void removeBroadcastInfo (int requestId)
```

Remove broadcast information request from the related TV input.   

If you override this method you *must* call through to the superclass implementation.

<br />

| Parameters ||
|---|---|
| `requestId` | `int`: the ID of the request <br /> |

### requestAd

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

```
public void requestAd (AdRequest request)
```

Sends an advertisement request to be processed by the related TV input.   

If you override this method you *must* call through to the superclass implementation.

<br />

| Parameters ||
|---|---|
| `request` | `AdRequest`: The advertisement request. This value cannot be `null`. <br /> |

### requestAvailableSpeeds

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

```
public void requestAvailableSpeeds ()
```

Requests available speeds for time shift.   

If you override this method you *must* call through to the superclass implementation.

<br />

### requestBroadcastInfo

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

```
public void requestBroadcastInfo (BroadcastInfoRequest request)
```

Requests broadcast related information from the related TV input.   

If you override this method you *must* call through to the superclass implementation.

<br />

| Parameters ||
|---|---|
| `request` | `BroadcastInfoRequest`: the request for broadcast info. This value cannot be `null`. <br /> |

### requestCertificate

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

```
public void requestCertificate (String host, 
                int port)
```

Requests a SSL certificate for client validation.   

If you override this method you *must* call through to the superclass implementation.

<br />

| Parameters ||
|---|---|
| `host` | `String`: the host name of the SSL authentication server. This value cannot be `null`. <br /> |
| `port` | `int`: the port of the SSL authentication server. E.g., 443 <br /> |

### requestCurrentChannelLcn

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

```
public void requestCurrentChannelLcn ()
```

Requests the logic channel number (LCN) of the current channel.   

If you override this method you *must* call through to the superclass implementation.

<br />

### requestCurrentChannelUri

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

```
public void requestCurrentChannelUri ()
```

Requests the URI of the current channel.   

If you override this method you *must* call through to the superclass implementation.

<br />

### requestCurrentTvInputId

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

```
public void requestCurrentTvInputId ()
```

Requests current TV input ID.   

If you override this method you *must* call through to the superclass implementation.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/tv/TvInputInfo`

### requestCurrentVideoBounds

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

```
public void requestCurrentVideoBounds ()
```

Requests the bounds of the current video.   

If you override this method you *must* call through to the superclass implementation.

<br />

### requestScheduleRecording

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

```
public void requestScheduleRecording (String requestId, 
                String inputId, 
                Uri channelUri, 
                Uri programUri, 
                Bundle params)
```

Requests scheduling of a recording.   

If you override this method you *must* call through to the superclass implementation.

<br />

| Parameters ||
|---|---|
| `requestId` | `String`: The ID of this request which is used to match the corresponding response. The request ID in `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onRecordingScheduled(java.lang.String,%20java.lang.String)` for this request is the same as the ID sent here. This should be defined by the `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService` and can be any string. Should this API be called with the same requestId twice, both requests should be handled regardless by the TV application. This value cannot be `null`. <br /> |
| `inputId` | `String`: The ID of the TV input for the given channel. This value cannot be `null`. <br /> |
| `channelUri` | `Uri`: The URI of a channel to be recorded. This value cannot be `null`. <br /> |
| `programUri` | `Uri`: The URI of the TV program to be recorded. This value cannot be `null`. <br /> |
| `params` | `Bundle`: Domain-specific data for this tune request. Keys *must* be a scoped name, i.e. prefixed with a package name you own, so that different developers will not create conflicting keys. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/tv/TvRecordingClient#tune(java.lang.String,%20android.net.Uri,%20android.os.Bundle)`
- `https://developer.android.com/reference/android/media/tv/TvRecordingClient#startRecording(android.net.Uri)`

### requestScheduleRecording

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

```
public void requestScheduleRecording (String requestId, 
                String inputId, 
                Uri channelUri, 
                long startTime, 
                long duration, 
                int repeatDays, 
                Bundle params)
```

Requests scheduling of a recording.   

If you override this method you *must* call through to the superclass implementation.

<br />

| Parameters ||
|---|---|
| `requestId` | `String`: The ID of this request which is used to match the corresponding response. The request ID in `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onRecordingScheduled(java.lang.String,%20java.lang.String)` for this request is the same as the ID sent here. This should be defined by the `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService` and can be any string. Should this API be called with the same requestId twice, both requests should be handled regardless by the TV application. This value cannot be `null`. <br /> |
| `inputId` | `String`: The ID of the TV input for the given channel. This value cannot be `null`. <br /> |
| `channelUri` | `Uri`: The URI of a channel to be recorded. This value cannot be `null`. <br /> |
| `startTime` | `long`: The start time of the recording in milliseconds since epoch. <br /> |
| `duration` | `long`: The duration of the recording in milliseconds. <br /> |
| `repeatDays` | `int`: The repeated days. 0 if not repeated. <br /> |
| `params` | `Bundle`: Domain-specific data for this tune request. Keys *must* be a scoped name, i.e. prefixed with a package name you own, so that different developers will not create conflicting keys. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/tv/TvRecordingClient#tune(java.lang.String,%20android.net.Uri,%20android.os.Bundle)`
- `https://developer.android.com/reference/android/media/tv/TvRecordingClient#startRecording(android.net.Uri)`

### requestSelectedTrackInfo

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

```
public void requestSelectedTrackInfo ()
```

Requests a list of the currently selected `https://developer.android.com/reference/android/media/tv/TvTrackInfo` from the TV App.

Normally, track info cannot be synchronized until the channel has been changed. This is used when the session of the `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService` is newly created and the normal synchronization has not happened yet.

The track info will be returned in `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onSelectedTrackInfo(java.util.List<android.media.tv.TvTrackInfo>)`   

If you override this method you *must* call through to the superclass implementation.

<br />

### requestSigning

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

```
public void requestSigning (String signingId, 
                String algorithm, 
                String alias, 
                byte[] data)
```

Requests signing of the given data.

This is used when the corresponding server of the broadcast-independent interactive app requires signing during handshaking, and the interactive app service doesn't have the built-in private key. The private key is provided by the content providers and pre-built in the related app, such as TV app.   

If you override this method you *must* call through to the superclass implementation.

<br />

| Parameters ||
|---|---|
| `signingId` | `String`: the ID to identify the request. When a result is received, this ID can be used to correlate the result with the request. This value cannot be `null`. <br /> |
| `algorithm` | `String`: the standard name of the signature algorithm requested, such as MD5withRSA, SHA256withDSA, etc. The name is from standards like FIPS PUB 186-4 and PKCS #1. This value cannot be `null`. <br /> |
| `alias` | `String`: the alias of the corresponding `https://developer.android.com/reference/java/security/KeyStore`. This value cannot be `null`. <br /> |
| `data` | `byte`: the original bytes to be signed. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onSigningResult(java.lang.String,%20byte[])`
- `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppView#createBiInteractiveApp(android.net.Uri,%20android.os.Bundle)`
- `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppView#BI_INTERACTIVE_APP_KEY_ALIAS`

### requestSigning

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

```
public void requestSigning (String signingId, 
                String algorithm, 
                String host, 
                int port, 
                byte[] data)
```

Requests signing of the given data.

This is used when the corresponding server of the broadcast-independent interactive app requires signing during handshaking, and the interactive app service doesn't have the built-in private key. The private key is provided by the content providers and pre-built in the related app, such as TV app.   

If you override this method you *must* call through to the superclass implementation.

<br />

| Parameters ||
|---|---|
| `signingId` | `String`: the ID to identify the request. When a result is received, this ID can be used to correlate the result with the request. This value cannot be `null`. <br /> |
| `algorithm` | `String`: the standard name of the signature algorithm requested, such as MD5withRSA, SHA256withDSA, etc. The name is from standards like FIPS PUB 186-4 and PKCS #1. This value cannot be `null`. <br /> |
| `host` | `String`: the host of the SSL client authentication server. This value cannot be `null`. <br /> |
| `port` | `int`: the port of the SSL client authentication server. <br /> |
| `data` | `byte`: the original bytes to be signed. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onSigningResult(java.lang.String,%20byte[])`
- `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppView#createBiInteractiveApp(android.net.Uri,%20android.os.Bundle)`
- `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppView#BI_INTERACTIVE_APP_KEY_ALIAS`

### requestStartRecording

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

```
public void requestStartRecording (String requestId, 
                Uri programUri)
```

Requests starting of recording

This is used to request the active `https://developer.android.com/reference/android/media/tv/TvRecordingClient` to call `https://developer.android.com/reference/android/media/tv/TvRecordingClient#startRecording(android.net.Uri)` with the provided `programUri`. A non-null `programUri` implies the started recording should be of that specific program, whereas null `programUri` does not impose such a requirement and the recording can span across multiple TV programs.   

If you override this method you *must* call through to the superclass implementation.

<br />

| Parameters ||
|---|---|
| `requestId` | `String`: The ID of this request which is used to match the corresponding response. The request ID in `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService.Session#onRecordingStarted(java.lang.String,%20java.lang.String)` for this request is the same as the ID sent here. This should be defined by the `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService` and can be any string. Should this API be called with the same requestId twice, both requests should be handled regardless by the TV application. This value cannot be `null`. <br /> |
| `programUri` | `Uri`: The URI for the TV program to record, built by `https://developer.android.com/reference/android/media/tv/TvContract#buildProgramUri(long)`. Can be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/tv/TvRecordingClient#startRecording(android.net.Uri)`

### requestStopRecording

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

```
public void requestStopRecording (String recordingId)
```

Requests the recording associated with the recordingId to stop.

This is used to request the associated `https://developer.android.com/reference/android/media/tv/TvRecordingClient` to call `https://developer.android.com/reference/android/media/tv/TvRecordingClient#stopRecording()`.   

If you override this method you *must* call through to the superclass implementation.

<br />

| Parameters ||
|---|---|
| `recordingId` | `String`: The ID of the recording to stop. This is provided by the TV app in `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppView#notifyRecordingStarted(java.lang.String,%20java.lang.String)` This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/tv/TvRecordingClient#stopRecording()`

### requestStreamVolume

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

```
public void requestStreamVolume ()
```

Requests stream volume.   

If you override this method you *must* call through to the superclass implementation.

<br />

### requestTimeShiftMode

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

```
public void requestTimeShiftMode ()
```

Requests time shift mode.   

If you override this method you *must* call through to the superclass implementation.

<br />

### requestTrackInfoList

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

```
public void requestTrackInfoList ()
```

Requests the list of `https://developer.android.com/reference/android/media/tv/TvTrackInfo`.   

If you override this method you *must* call through to the superclass implementation.

<br />

### requestTvRecordingInfo

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

```
public void requestTvRecordingInfo (String recordingId)
```

Gets the recording info for the specified recording.   

If you override this method you *must* call through to the superclass implementation.

<br />

| Parameters ||
|---|---|
| `recordingId` | `String`: The ID of the recording to set the info for. This is provided by the TV app in `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppView#notifyRecordingStarted(java.lang.String,%20java.lang.String)` This value cannot be `null`. <br /> |

### requestTvRecordingInfoList

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

```
public void requestTvRecordingInfoList (int type)
```

Gets a list of `https://developer.android.com/reference/android/media/tv/TvRecordingInfo` for the specified recording type.   

If you override this method you *must* call through to the superclass implementation.

<br />

| Parameters ||
|---|---|
| `type` | `int`: The type of recording to retrieve. Value is one of the following: - `https://developer.android.com/reference/android/media/tv/TvRecordingInfo#RECORDING_SCHEDULED` - `https://developer.android.com/reference/android/media/tv/TvRecordingInfo#RECORDING_IN_PROGRESS` - `https://developer.android.com/reference/android/media/tv/TvRecordingInfo#RECORDING_ALL` |

### sendPlaybackCommandRequest

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

```
public void sendPlaybackCommandRequest (String cmdType, 
                Bundle parameters)
```

Sends a specific playback command to be processed by the related TV input.   

If you override this method you *must* call through to the superclass implementation.

<br />

| Parameters ||
|---|---|
| `cmdType` | `String`: type of the specific command. Value is one of the following: - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_TUNE` - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_TUNE_NEXT` - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_TUNE_PREV` - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_STOP` - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_SET_STREAM_VOLUME` - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_SELECT_TRACK` . This value cannot be `null`. |
| `parameters` | `Bundle`: parameters of the specific command. This value may be `null`. <br /> |

### sendTimeShiftCommandRequest

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

```
public void sendTimeShiftCommandRequest (String cmdType, 
                Bundle parameters)
```

Sends a specific time shift command to be processed by the related TV input.   

If you override this method you *must* call through to the superclass implementation.

<br />

| Parameters ||
|---|---|
| `cmdType` | `String`: type of the specific command. Value is one of the following: - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_PLAY` - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_PAUSE` - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_RESUME` - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_SEEK_TO` - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_SET_PLAYBACK_PARAMS` - `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_SET_MODE` . This value cannot be `null`. |
| `parameters` | `Bundle`: parameters of the specific command. This value may be `null`. <br /> |

### setMediaViewEnabled

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

```
public void setMediaViewEnabled (boolean enable)
```

Enables or disables the media view.

By default, the media view is disabled. Must be called explicitly after the session is created to enable the media view.

The TV Interactive App service can disable its media view when needed.   

If you override this method you *must* call through to the superclass implementation.

<br />

| Parameters ||
|---|---|
| `enable` | `boolean`: `true` if you want to enable the media view. `false` otherwise. <br /> |

### setTvRecordingInfo

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

```
public void setTvRecordingInfo (String recordingId, 
                TvRecordingInfo recordingInfo)
```

Sets the recording info for the specified recording.   

If you override this method you *must* call through to the superclass implementation.

<br />

| Parameters ||
|---|---|
| `recordingId` | `String`: The ID of the recording to set the info for. This is provided by the TV app in `https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppView#notifyRecordingStarted(java.lang.String,%20java.lang.String)` This value cannot be `null`. <br /> |
| `recordingInfo` | `TvRecordingInfo`: The `https://developer.android.com/reference/android/media/tv/TvRecordingInfo` to set to the recording. This value cannot be `null`. <br /> |

### setVideoBounds

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

```
public void setVideoBounds (Rect rect)
```

Sets broadcast video bounds.   

If you override this method you *must* call through to the superclass implementation.

<br />

| Parameters ||
|---|---|
| `rect` | `Rect`: the video bounds. This value cannot be `null`. <br /> |