TvAdManager


public final class TvAdManager
extends Object

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

class TvAdManager.TvAdServiceCallback

Callback used to monitor status of the TV advertisement service. 

Constants

String ACTION_APP_LINK_COMMAND

Broadcast intent action to send app command to TV app.

String APP_LINK_KEY_BACK_URI

Key for back URI in app link command.

String APP_LINK_KEY_CLASS_NAME

Key for class name in app link.

String APP_LINK_KEY_COMMAND_TYPE

Key for command type in app link command.

String APP_LINK_KEY_PACKAGE_NAME

Key for package name in app link.

String APP_LINK_KEY_SERVICE_ID

Key for service ID in app link command.

int ERROR_BLOCKED

Error code for blocked contents.

int ERROR_ENCRYPTED

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

int ERROR_NONE

No error.

int ERROR_NOT_SUPPORTED

Error code for an unsupported channel.

int ERROR_RESOURCE_UNAVAILABLE

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

int ERROR_UNKNOWN

Unknown error code.

int ERROR_UNKNOWN_CHANNEL

Error code when the current channel is an unknown channel.

int ERROR_WEAK_SIGNAL

Error code for weak signal.

String INTENT_KEY_AD_SERVICE_ID

Intent key for TV AD service ID.

String INTENT_KEY_CHANNEL_URI

Intent key for TV channel URI.

String INTENT_KEY_COMMAND_TYPE

Intent key for command type.

String INTENT_KEY_TV_INPUT_ID

Intent key for TV input ID.

String SESSION_DATA_KEY_AD_BUFFER

An object of AdBuffer.

String SESSION_DATA_KEY_AD_REQUEST

An object of AdRequest.

String SESSION_DATA_KEY_BROADCAST_INFO_REQUEST

An object of BroadcastInfoRequest.

String SESSION_DATA_KEY_REQUEST_ID

The ID of BroadcastInfoRequest.

String SESSION_DATA_TYPE_AD_BUFFER_READY

Notifies the advertisement buffer is ready.

String SESSION_DATA_TYPE_AD_REQUEST

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

String SESSION_DATA_TYPE_BROADCAST_INFO_REQUEST

Sends request for broadcast info.

String SESSION_DATA_TYPE_REMOVE_BROADCAST_INFO_REQUEST

Removes request for broadcast info.

int SESSION_STATE_ERROR

Error state of AD service session.

int SESSION_STATE_RUNNING

Running state of AD service session.

int SESSION_STATE_STOPPED

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

Public methods

List<TvAdServiceInfo> getTvAdServiceList()

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

void registerCallback(Executor executor, TvAdManager.TvAdServiceCallback callback)

Registers a TvAdServiceCallback.

void sendAppLinkCommand(String serviceId, Bundle command)

Sends app link command.

void unregisterCallback(TvAdManager.TvAdServiceCallback callback)

Unregisters the existing TvAdServiceCallback.

Inherited methods

Constants

public static final String ACTION_APP_LINK_COMMAND

Broadcast intent action to send app command to TV app.

Constant Value: "android.media.tv.ad.action.APP_LINK_COMMAND"

public static final String APP_LINK_KEY_BACK_URI

Key for back URI in app link command.

Type: String

Constant Value: "back_uri"

public static final String APP_LINK_KEY_CLASS_NAME

Key for class name in app link.

Type: String

Constant Value: "class_name"

public static final String APP_LINK_KEY_COMMAND_TYPE

Key for command type in app link command.

Type: String

Constant Value: "command_type"

public static final String APP_LINK_KEY_PACKAGE_NAME

Key for package name in app link.

Type: String

Constant Value: "package_name"

public static final String APP_LINK_KEY_SERVICE_ID

Key for service ID in app link command.

Type: String

Constant Value: "service_id"

ERROR_BLOCKED

public static final int ERROR_BLOCKED

Error code for blocked contents.

Constant Value: 5 (0x00000005)

ERROR_ENCRYPTED

public static final int ERROR_ENCRYPTED

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

Constant Value: 6 (0x00000006)

ERROR_NONE

public static final int ERROR_NONE

No error.

Constant Value: 0 (0x00000000)

ERROR_NOT_SUPPORTED

public static final int ERROR_NOT_SUPPORTED

Error code for an unsupported channel.

Constant Value: 2 (0x00000002)

ERROR_RESOURCE_UNAVAILABLE

public static final int ERROR_RESOURCE_UNAVAILABLE

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

Constant Value: 4 (0x00000004)

ERROR_UNKNOWN

public static final int ERROR_UNKNOWN

Unknown error code.

Constant Value: 1 (0x00000001)

ERROR_UNKNOWN_CHANNEL

public static final int ERROR_UNKNOWN_CHANNEL

Error code when the current channel is an unknown channel.

Constant Value: 7 (0x00000007)

ERROR_WEAK_SIGNAL

public static final int ERROR_WEAK_SIGNAL

Error code for weak signal.

Constant Value: 3 (0x00000003)

INTENT_KEY_AD_SERVICE_ID

public static final String INTENT_KEY_AD_SERVICE_ID

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

Type: String

Constant Value: "ad_service_id"

INTENT_KEY_CHANNEL_URI

public static final String INTENT_KEY_CHANNEL_URI

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

Type: android.net.Uri

Constant Value: "channel_uri"

INTENT_KEY_COMMAND_TYPE

public static final String INTENT_KEY_COMMAND_TYPE

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

Constant Value: "command_type"

INTENT_KEY_TV_INPUT_ID

public static final String INTENT_KEY_TV_INPUT_ID

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

Type: String

Constant Value: "tv_input_id"

SESSION_DATA_KEY_AD_BUFFER

public static final String SESSION_DATA_KEY_AD_BUFFER

An object of AdBuffer.

Type: android.media.tv.AdBuffer

Constant Value: "ad_buffer"

SESSION_DATA_KEY_AD_REQUEST

public static final String SESSION_DATA_KEY_AD_REQUEST

An object of AdRequest.

Type: android.media.tv.AdRequest

Constant Value: "ad_request"

SESSION_DATA_KEY_BROADCAST_INFO_REQUEST

public static final String SESSION_DATA_KEY_BROADCAST_INFO_REQUEST

An object of BroadcastInfoRequest.

Type: android.media.tv.BroadcastInfoRequest

Constant Value: "broadcast_info_request"

SESSION_DATA_KEY_REQUEST_ID

public static final String SESSION_DATA_KEY_REQUEST_ID

The ID of BroadcastInfoRequest.

Type: Integer

Constant Value: "request_id"

SESSION_DATA_TYPE_AD_BUFFER_READY

public static final String SESSION_DATA_TYPE_AD_BUFFER_READY

Notifies the advertisement buffer is ready.

Constant Value: "ad_buffer_ready"

SESSION_DATA_TYPE_AD_REQUEST

public static final String SESSION_DATA_TYPE_AD_REQUEST

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

Constant Value: "ad_request"

SESSION_DATA_TYPE_BROADCAST_INFO_REQUEST

public static final String SESSION_DATA_TYPE_BROADCAST_INFO_REQUEST

Sends request for broadcast info.

Constant Value: "broadcast_info_request"

SESSION_DATA_TYPE_REMOVE_BROADCAST_INFO_REQUEST

public static final String SESSION_DATA_TYPE_REMOVE_BROADCAST_INFO_REQUEST

Removes request for broadcast info.

Constant Value: "remove_broadcast_info_request"

SESSION_STATE_ERROR

public static final int SESSION_STATE_ERROR

Error state of AD service session.

Constant Value: 3 (0x00000003)

SESSION_STATE_RUNNING

public static final int SESSION_STATE_RUNNING

Running state of AD service session.

Constant Value: 2 (0x00000002)

SESSION_STATE_STOPPED

public static final int SESSION_STATE_STOPPED

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

Constant Value: 1 (0x00000001)

Public methods

getTvAdServiceList

public List<TvAdServiceInfo> getTvAdServiceList ()

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

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

registerCallback

public void registerCallback (Executor executor, 
                TvAdManager.TvAdServiceCallback callback)

Registers a TvAdServiceCallback.

Parameters
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.

callback TvAdManager.TvAdServiceCallback: A callback used to monitor status of the TV AD services. This value cannot be null.

sendAppLinkCommand

public void sendAppLinkCommand (String serviceId, 
                Bundle command)

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

public void unregisterCallback (TvAdManager.TvAdServiceCallback callback)

Unregisters the existing TvAdServiceCallback.

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