TvInputService

public abstract class TvInputService
extends Service

java.lang.Object
   ↳ 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 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

class TvInputService.HardwareSession

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

class TvInputService.RecordingSession

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

class TvInputService.Session

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

Constants

String SERVICE_INTERFACE

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.

String SERVICE_META_DATA

Name under which a TvInputService component publishes information about itself.

Inherited constants

Public constructors

TvInputService()

Public methods

final IBinder onBind(Intent intent)

Return the communication channel to the service.

TvInputService.RecordingSession onCreateRecordingSession(String inputId)

Returns a concrete implementation of TvInputService.RecordingSession.

abstract TvInputService.Session onCreateSession(String inputId)

Returns a concrete implementation of TvInputService.Session.

Inherited methods

Constants

SERVICE_INTERFACE

added in API level 21
public static final String SERVICE_INTERFACE

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 Manifest.permission.BIND_TV_INPUT permission so that other applications cannot abuse it.

Constant Value: "android.media.tv.TvInputService"

SERVICE_META_DATA

added in API level 21
public static final String SERVICE_META_DATA

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

Constant Value: "android.media.tv.input"

Public constructors

TvInputService

added in API level 21
public TvInputService ()

Public methods

onBind

added in API level 21
public final IBinder onBind (Intent intent)

Return the communication channel to the service. May return null if clients can not bind to the service. The returned IBinder is usually for a complex interface that has been described using aidl.

Note that unlike other application components, calls on to the IBinder interface returned here may not happen on the main thread of the process. More information about the main thread can be found in Processes and Threads.

Parameters
intent Intent: The Intent that was used to bind to this service, as given to Context.bindService. Note that any extras that were included with the Intent at that point will not be seen here.

Returns
IBinder Return an IBinder through which clients can call on to the service.

onCreateRecordingSession

added in API level 24
public TvInputService.RecordingSession onCreateRecordingSession (String inputId)

Returns a concrete implementation of TvInputService.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.

Returns
TvInputService.RecordingSession

This value may be null.

onCreateSession

added in API level 21
public abstract TvInputService.Session onCreateSession (String inputId)

Returns a concrete implementation of TvInputService.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, TvInputService.HardwareSession should be returned.

Parameters
inputId String: The ID of the TV input associated with the session.

Returns
TvInputService.Session

This value may be null.