Added in API level 21

TvInputService


abstract class TvInputService : Service
kotlin.Any
   ↳ android.content.Context
   ↳ android.content.ContextWrapper
   ↳ android.app.Service
   ↳ android.media.tv.TvInputService

The TvInputService class represents a TV input or source such as HDMI or built-in tuner which provides pass-through video or broadcast TV programs.

Applications will not normally use this service themselves, instead relying on the standard interaction provided by TvView. Those implementing TV input services should normally do so by deriving from this class and providing their own session implementation based on TvInputService.Session. All TV input services must require that clients hold the android.Manifest.permission#BIND_TV_INPUT in order to interact with the service; if this permission is not specified in the manifest, the system will refuse to bind to that TV input service.

Summary

Nested classes
abstract

Base class for a TV input session which represents an external device connected to a hardware TV input.

abstract

Base class for derived classes to implement to provide a TV input recording session.

abstract

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

Constants
static Int

Use case of priority hint for android.media.MediaCas#MediaCas(Context, int, String, * int): Background.

static Int

Use case of priority hint for android.media.MediaCas#MediaCas(Context, int, String, * int): Live.

static Int

Use case of priority hint for android.media.MediaCas#MediaCas(Context, int, String, * int): Playback.

static Int

Use case of priority hint for android.media.MediaCas#MediaCas(Context, int, String, * int): Record.

static Int

Use case of priority hint for android.media.MediaCas#MediaCas(Context, int, String, * int): Scan.

static String

This is the interface name that a service implementing a TV input should say that it support -- that is, this is the action it uses for its intent filter.

static String

Name under which a TvInputService component publishes information about itself.

Inherited constants
Public constructors

Public methods
IBinder?
onBind(intent: Intent!)

open TvInputService.RecordingSession?

Returns a concrete implementation of RecordingSession.

open TvInputService.RecordingSession?
onCreateRecordingSession(inputId: String, sessionId: String)

Returns a concrete implementation of RecordingSession.

abstract TvInputService.Session?

Returns a concrete implementation of Session.

open TvInputService.Session?
onCreateSession(inputId: String, sessionId: String)

Returns a concrete implementation of Session.

open TvInputService.Session?
onCreateSession(inputId: String, sessionId: String, tvAppAttributionSource: AttributionSource)

Returns a concrete implementation of Session.

Inherited functions

Constants

PRIORITY_HINT_USE_CASE_TYPE_BACKGROUND

Added in API level 30
static val PRIORITY_HINT_USE_CASE_TYPE_BACKGROUND: Int

Use case of priority hint for android.media.MediaCas#MediaCas(Context, int, String, * int): Background. TODO Link: Tuner#Tuner(Context, string, int).

Value: 100

PRIORITY_HINT_USE_CASE_TYPE_LIVE

Added in API level 30
static val PRIORITY_HINT_USE_CASE_TYPE_LIVE: Int

Use case of priority hint for android.media.MediaCas#MediaCas(Context, int, String, * int): Live. TODO Link: Tuner#Tuner(Context, string, int).

Value: 400

PRIORITY_HINT_USE_CASE_TYPE_PLAYBACK

Added in API level 30
static val PRIORITY_HINT_USE_CASE_TYPE_PLAYBACK: Int

Use case of priority hint for android.media.MediaCas#MediaCas(Context, int, String, * int): Playback. TODO Link: Tuner#Tuner(Context, string, int).

Value: 300

PRIORITY_HINT_USE_CASE_TYPE_RECORD

Added in API level 30
static val PRIORITY_HINT_USE_CASE_TYPE_RECORD: Int

Use case of priority hint for android.media.MediaCas#MediaCas(Context, int, String, * int): Record. TODO Link: Tuner#Tuner(Context, string, int).

Value: 500

PRIORITY_HINT_USE_CASE_TYPE_SCAN

Added in API level 30
static val PRIORITY_HINT_USE_CASE_TYPE_SCAN: Int

Use case of priority hint for android.media.MediaCas#MediaCas(Context, int, String, * int): Scan. TODO Link: Tuner#Tuner(Context, string, int).

Value: 200

SERVICE_INTERFACE

Added in API level 21
static val SERVICE_INTERFACE: String

This is the interface name that a service implementing a TV input should say that it support -- that is, this is the action it uses for its intent filter. To be supported, the service must also require the android.Manifest.permission#BIND_TV_INPUT permission so that other applications cannot abuse it.

Value: "android.media.tv.TvInputService"

SERVICE_META_DATA

Added in API level 21
static val SERVICE_META_DATA: String

Name under which a TvInputService component publishes information about itself. This meta-data must reference an XML resource containing an <tv-input> tag.

Value: "android.media.tv.input"

Public constructors

TvInputService

TvInputService()

Public methods

onBind

Added in API level 21
fun onBind(intent: Intent!): IBinder?
Parameters
intent Intent!: The Intent that was used to bind to this service, as given to android.content.Context#bindService. Note that any extras that were included with the Intent at that point will not be seen here.
Return
IBinder? Return an IBinder through which clients can call on to the service.

onCreateRecordingSession

Added in API level 24
open fun onCreateRecordingSession(inputId: String): TvInputService.RecordingSession?

Returns a concrete implementation of RecordingSession.

May return null if this TV input service fails to create a recording session for some reason.

Parameters
inputId String: The ID of the TV input associated with the recording session. This value cannot be null.

onCreateRecordingSession

Added in API level 30
open fun onCreateRecordingSession(
    inputId: String,
    sessionId: String
): TvInputService.RecordingSession?

Returns a concrete implementation of RecordingSession.

For any apps that needs sessionId to request tuner resources from TunerResourceManager, it needs to override this method to get the sessionId passed. When no overriding, this method calls onCreateRecordingSession(java.lang.String) defaultly.

Parameters
inputId String: The ID of the TV input associated with the recording session. This value cannot be null.
sessionId String: the unique sessionId created by TIF when session is created. This value cannot be null.
Return
TvInputService.RecordingSession? This value may be null.

onCreateSession

Added in API level 21
abstract fun onCreateSession(inputId: String): TvInputService.Session?

Returns a concrete implementation of Session.

May return null if this TV input service fails to create a session for some reason. If TV input represents an external device connected to a hardware TV input, HardwareSession should be returned.

Parameters
inputId String: The ID of the TV input associated with the session. This value cannot be null.

onCreateSession

Added in API level 30
open fun onCreateSession(
    inputId: String,
    sessionId: String
): TvInputService.Session?

Returns a concrete implementation of Session.

For any apps that needs sessionId to request tuner resources from TunerResourceManager, it needs to override this method to get the sessionId passed. When no overriding, this method calls onCreateSession(java.lang.String) defaultly.

Parameters
inputId String: The ID of the TV input associated with the session. This value cannot be null.
sessionId String: the unique sessionId created by TIF when session is created. This value cannot be null.
Return
TvInputService.Session? This value may be null.

onCreateSession

Added in API level 34
open fun onCreateSession(
    inputId: String,
    sessionId: String,
    tvAppAttributionSource: AttributionSource
): TvInputService.Session?

Returns a concrete implementation of Session.

For any apps that needs sessionId to request tuner resources from TunerResourceManager and needs to specify custom AttributionSource to AudioTrack, it needs to override this method to get the sessionId and AttrubutionSource passed. When no overriding, this method calls onCreateSession(java.lang.String,java.lang.String) defaultly.

Parameters
inputId String: The ID of the TV input associated with the session. This value cannot be null.
sessionId String: the unique sessionId created by TIF when session is created. This value cannot be null.
tvAppAttributionSource AttributionSource: The Attribution Source of the TV App. This value cannot be null.
Return
TvInputService.Session? This value may be null.