Android APIs
public final class

TvContract

extends Object
java.lang.Object
   ↳ android.media.tv.TvContract

Class Overview

The contract between the TV provider and applications. Contains definitions for the supported URIs and columns.

Overview

TvContract defines a basic database of TV content metadata such as channel and program information. The information is stored in TvContract.Channels and TvContract.Programs tables.

  • A row in the TvContract.Channels table represents information about a TV channel. The data format can vary greatly from standard to standard or according to service provider, thus the columns here are mostly comprised of basic entities that are usually seen to users regardless of standard such as channel number and name.
  • A row in the TvContract.Programs table represents a set of data describing a TV program such as program title and start time.

Summary

Nested Classes
interface TvContract.BaseTvColumns Common base for the tables of TV channels/programs. 
class TvContract.Channels Column definitions for the TV channels table. 
class TvContract.Programs Column definitions for the TV programs table. 
Constants
String AUTHORITY The authority for the TV provider.
Public Methods
final static Uri buildChannelLogoUri(Uri channelUri)
Builds a URI that points to a channel logo.
final static Uri buildChannelLogoUri(long channelId)
Builds a URI that points to a channel logo.
final static Uri buildChannelUri(long channelId)
Builds a URI that points to a specific channel.
final static Uri buildChannelUriForPassthroughInput(String inputId)
Build a special channel URI intended to be used with pass-through inputs.
final static Uri buildChannelsUriForInput(String inputId)
Builds a URI that points to all channels from a given TV input.
final static String buildInputId(ComponentName name)
Builds an ID that uniquely identifies a TV input service.
final static Uri buildProgramUri(long programId)
Builds a URI that points to a specific program.
final static Uri buildProgramsUriForChannel(Uri channelUri)
Builds a URI that points to all programs on a given channel.
final static Uri buildProgramsUriForChannel(long channelId, long startTime, long endTime)
Builds a URI that points to programs on a specific channel whose schedules overlap with the given time frame.
final static Uri buildProgramsUriForChannel(Uri channelUri, long startTime, long endTime)
Builds a URI that points to programs on a specific channel whose schedules overlap with the given time frame.
final static Uri buildProgramsUriForChannel(long channelId)
Builds a URI that points to all programs on a given channel.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String AUTHORITY

Added in API level 21

The authority for the TV provider.

Constant Value: "android.media.tv"

Public Methods

public static final Uri buildChannelLogoUri (Uri channelUri)

Added in API level 21

Builds a URI that points to a channel logo. See TvContract.Channels.Logo.

Parameters
channelUri The URI of the channel whose logo is pointed to.

public static final Uri buildChannelLogoUri (long channelId)

Added in API level 21

Builds a URI that points to a channel logo. See TvContract.Channels.Logo.

Parameters
channelId The ID of the channel whose logo is pointed to.

public static final Uri buildChannelUri (long channelId)

Added in API level 21

Builds a URI that points to a specific channel.

Parameters
channelId The ID of the channel to point to.

public static final Uri buildChannelUriForPassthroughInput (String inputId)

Added in API level 21

Build a special channel URI intended to be used with pass-through inputs. (e.g. HDMI)

Parameters
inputId The ID of the pass-through input to build a channels URI for.

public static final Uri buildChannelsUriForInput (String inputId)

Added in API level 21

Builds a URI that points to all channels from a given TV input.

Parameters
inputId The ID of the TV input to build a channels URI for. If null, builds a URI for all the TV inputs.

public static final String buildInputId (ComponentName name)

Added in API level 21

Builds an ID that uniquely identifies a TV input service.

Parameters
name The ComponentName of the TV input service to build ID for.
Returns
  • the ID for the given TV input service.

public static final Uri buildProgramUri (long programId)

Added in API level 21

Builds a URI that points to a specific program.

Parameters
programId The ID of the program to point to.

public static final Uri buildProgramsUriForChannel (Uri channelUri)

Added in API level 21

Builds a URI that points to all programs on a given channel.

Parameters
channelUri The URI of the channel to return programs for.

public static final Uri buildProgramsUriForChannel (long channelId, long startTime, long endTime)

Added in API level 21

Builds a URI that points to programs on a specific channel whose schedules overlap with the given time frame.

Parameters
channelId The ID of the channel to return programs for.
startTime The start time used to filter programs. The returned programs should have COLUMN_END_TIME_UTC_MILLIS that is greater than this time.
endTime The end time used to filter programs. The returned programs should have COLUMN_START_TIME_UTC_MILLIS that is less than this time.

public static final Uri buildProgramsUriForChannel (Uri channelUri, long startTime, long endTime)

Added in API level 21

Builds a URI that points to programs on a specific channel whose schedules overlap with the given time frame.

Parameters
channelUri The URI of the channel to return programs for.
startTime The start time used to filter programs. The returned programs should have COLUMN_END_TIME_UTC_MILLIS that is greater than this time.
endTime The end time used to filter programs. The returned programs should have COLUMN_START_TIME_UTC_MILLIS that is less than this time.

public static final Uri buildProgramsUriForChannel (long channelId)

Added in API level 21

Builds a URI that points to all programs on a given channel.

Parameters
channelId The ID of the channel to return programs for.