TvAdManager


class TvAdManager
kotlin.Any
   ↳ android.media.tv.ad.TvAdManager

Central system API to the overall client-side TV AD architecture, which arbitrates interaction between applications and AD services.

Summary

Nested classes
abstract

Callback used to monitor status of the TV advertisement service.

Constants
static String

Broadcast intent action to send app command to TV app.

static String

Key for back URI in app link command.

static String

Key for class name in app link.

static String

Key for command type in app link command.

static String

Key for package name in app link.

static String

Key for service ID in app link command.

static Int

Error code for blocked contents.

static Int

Error code when the key or module is missing for the encrypted channel.

static Int

No error.

static Int

Error code for an unsupported channel.

static Int

Error code when resource (e.g. tuner) is unavailable.

static Int

Unknown error code.

static Int

Error code when the current channel is an unknown channel.

static Int

Error code for weak signal.

static String

Intent key for TV AD service ID.

static String

Intent key for TV channel URI.

static String

Intent key for command type.

static String

Intent key for TV input ID.

static String

An object of AdBuffer.

static String

An object of android.media.tv.AdRequest.

static String

An object of android.media.tv.BroadcastInfoRequest.

static String

The ID of android.media.tv.BroadcastInfoRequest.

static String

Notifies the advertisement buffer is ready.

static String

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

static String

Sends request for broadcast info.

static String

Removes request for broadcast info.

static Int

Error state of AD service session.

static Int

Running state of AD service session.

static Int

Stopped (or not started) state of AD service session.

Public methods
MutableList<TvAdServiceInfo!>

Returns the complete list of TV AD services on the system.

Unit

Registers a TvAdServiceCallback.

Unit
sendAppLinkCommand(serviceId: String, command: Bundle)

Sends app link command.

Unit

Unregisters the existing TvAdServiceCallback.

Constants

static val ACTION_APP_LINK_COMMAND: String

Broadcast intent action to send app command to TV app.

Value: "android.media.tv.ad.action.APP_LINK_COMMAND"
static val APP_LINK_KEY_BACK_URI: String

Key for back URI in app link command.

Type: String

Value: "back_uri"
static val APP_LINK_KEY_CLASS_NAME: String

Key for class name in app link.

Type: String

Value: "class_name"
static val APP_LINK_KEY_COMMAND_TYPE: String

Key for command type in app link command.

Type: String

Value: "command_type"
static val APP_LINK_KEY_PACKAGE_NAME: String

Key for package name in app link.

Type: String

Value: "package_name"
static val APP_LINK_KEY_SERVICE_ID: String

Key for service ID in app link command.

Type: String

Value: "service_id"

ERROR_BLOCKED

static val ERROR_BLOCKED: Int

Error code for blocked contents.

Value: 5

ERROR_ENCRYPTED

static val ERROR_ENCRYPTED: Int

Error code when the key or module is missing for the encrypted channel.

Value: 6

ERROR_NONE

static val ERROR_NONE: Int

No error.

Value: 0

ERROR_NOT_SUPPORTED

static val ERROR_NOT_SUPPORTED: Int

Error code for an unsupported channel.

Value: 2

ERROR_RESOURCE_UNAVAILABLE

static val ERROR_RESOURCE_UNAVAILABLE: Int

Error code when resource (e.g. tuner) is unavailable.

Value: 4

ERROR_UNKNOWN

static val ERROR_UNKNOWN: Int

Unknown error code.

Value: 1

ERROR_UNKNOWN_CHANNEL

static val ERROR_UNKNOWN_CHANNEL: Int

Error code when the current channel is an unknown channel.

Value: 7

ERROR_WEAK_SIGNAL

static val ERROR_WEAK_SIGNAL: Int

Error code for weak signal.

Value: 3

INTENT_KEY_AD_SERVICE_ID

static val INTENT_KEY_AD_SERVICE_ID: String

Intent key for TV AD service ID. It's used to send app command to TV app.

Type: String

Value: "ad_service_id"

INTENT_KEY_CHANNEL_URI

static val INTENT_KEY_CHANNEL_URI: String

Intent key for TV channel URI. It's used to send app command to TV app.

Type: android.net.Uri

Value: "channel_uri"

INTENT_KEY_COMMAND_TYPE

static val INTENT_KEY_COMMAND_TYPE: String

Intent key for command type. It's used to send app command to TV app. The value of this key could vary according to TV apps.

Type: String

Value: "command_type"

INTENT_KEY_TV_INPUT_ID

static val INTENT_KEY_TV_INPUT_ID: String

Intent key for TV input ID. It's used to send app command to TV app.

Type: String

Value: "tv_input_id"

SESSION_DATA_KEY_AD_BUFFER

static val SESSION_DATA_KEY_AD_BUFFER: String

An object of AdBuffer.

Type: android.media.tv.AdBuffer

Value: "ad_buffer"

SESSION_DATA_KEY_AD_REQUEST

static val SESSION_DATA_KEY_AD_REQUEST: String

An object of android.media.tv.AdRequest.

Type: android.media.tv.AdRequest

Value: "ad_request"

SESSION_DATA_KEY_BROADCAST_INFO_REQUEST

static val SESSION_DATA_KEY_BROADCAST_INFO_REQUEST: String

An object of android.media.tv.BroadcastInfoRequest.

Type: android.media.tv.BroadcastInfoRequest

Value: "broadcast_info_request"

SESSION_DATA_KEY_REQUEST_ID

static val SESSION_DATA_KEY_REQUEST_ID: String

The ID of android.media.tv.BroadcastInfoRequest.

Type: Integer

Value: "request_id"

SESSION_DATA_TYPE_AD_BUFFER_READY

static val SESSION_DATA_TYPE_AD_BUFFER_READY: String

Notifies the advertisement buffer is ready.

Value: "ad_buffer_ready"

SESSION_DATA_TYPE_AD_REQUEST

static val SESSION_DATA_TYPE_AD_REQUEST: String

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

Value: "ad_request"

SESSION_DATA_TYPE_BROADCAST_INFO_REQUEST

static val SESSION_DATA_TYPE_BROADCAST_INFO_REQUEST: String

Sends request for broadcast info.

Value: "broadcast_info_request"

SESSION_DATA_TYPE_REMOVE_BROADCAST_INFO_REQUEST

static val SESSION_DATA_TYPE_REMOVE_BROADCAST_INFO_REQUEST: String

Removes request for broadcast info.

Value: "remove_broadcast_info_request"

SESSION_STATE_ERROR

static val SESSION_STATE_ERROR: Int

Error state of AD service session.

Value: 3

SESSION_STATE_RUNNING

static val SESSION_STATE_RUNNING: Int

Running state of AD service session.

Value: 2

SESSION_STATE_STOPPED

static val SESSION_STATE_STOPPED: Int

Stopped (or not started) state of AD service session.

Value: 1

Public methods

getTvAdServiceList

fun getTvAdServiceList(): MutableList<TvAdServiceInfo!>

Returns the complete list of TV AD services on the system.

Return
MutableList<TvAdServiceInfo!> List of TvAdServiceInfo for each TV AD service that describes its meta information. This value cannot be null.

registerCallback

fun registerCallback(
    executor: Executor,
    callback: TvAdManager.TvAdServiceCallback
): Unit

Registers a TvAdServiceCallback.

Parameters
callback TvAdManager.TvAdServiceCallback: A callback used to monitor status of the TV AD services. This value cannot be null.
executor Executor: A Executor that the status change will be delivered to. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread. This value cannot be null.

sendAppLinkCommand

fun sendAppLinkCommand(
    serviceId: String,
    command: Bundle
): Unit

Sends app link command.

Parameters
serviceId String: The ID of TV AD service which the command to be sent to. The ID can be found in TvAdServiceInfo.getId(). This value cannot be null.
command Bundle: The command to be sent. The command is a bundle with the following keys: This value cannot be null.

unregisterCallback

fun unregisterCallback(callback: TvAdManager.TvAdServiceCallback): Unit

Unregisters the existing TvAdServiceCallback.

Parameters
callback TvAdManager.TvAdServiceCallback: The existing callback to remove. This value cannot be null.