public final class TvContract extends Object
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.
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.TvContract.Programs
table represents a set of data describing a TV program such
as program title and start time.Modifier and Type | Class and Description |
---|---|
static interface |
TvContract.BaseTvColumns
Common base for the tables of TV channels/programs.
|
static class |
TvContract.Channels
Column definitions for the TV channels table.
|
static class |
TvContract.Programs
Column definitions for the TV programs table.
|
static class |
TvContract.RecordedPrograms
Column definitions for the recorded TV programs table.
|
static class |
TvContract.WatchedPrograms
Column definitions for the TV programs that the user watched.
|
Modifier and Type | Field and Description |
---|---|
static String |
AUTHORITY
The authority for the TV provider.
|
static String |
PARAM_BROWSABLE_ONLY
A query, update or delete URI parameter that allows the caller to operate on all or
browsable-only channels.
|
static String |
PARAM_CANONICAL_GENRE
A optional query, update or delete URI parameter that allows the caller to specify canonical
genre to filter programs.
|
static String |
PARAM_CHANNEL
An optional query, update or delete URI parameter that allows the caller to specify channel
ID to filter programs.
|
static String |
PARAM_END_TIME
An optional query, update or delete URI parameter that allows the caller to specify end time
(in milliseconds since the epoch) to filter programs.
|
static String |
PARAM_INPUT
An optional query, update or delete URI parameter that allows the caller to specify TV input
ID to filter channels.
|
static String |
PARAM_START_TIME
An optional query, update or delete URI parameter that allows the caller to specify start
time (in milliseconds since the epoch) to filter programs.
|
static String |
PERMISSION_READ_TV_LISTINGS
Permission to read TV listings.
|
Modifier and Type | Method and Description |
---|---|
static Uri |
buildChannelLogoUri(long channelId)
Builds a URI that points to a channel logo.
|
static Uri |
buildChannelLogoUri(Uri channelUri)
Builds a URI that points to a channel logo.
|
static Uri |
buildChannelsUriForInput(String inputId)
Builds a URI that points to all channels from a given TV input.
|
static Uri |
buildChannelsUriForInput(String inputId,
boolean browsableOnly)
Builds a URI that points to all or browsable-only channels from a given TV input.
|
static Uri |
buildChannelsUriForInput(String inputId,
String genre,
boolean browsableOnly)
Builds a URI that points to all or browsable-only channels which have programs with the given
genre from the given TV input.
|
static Uri |
buildChannelUri(long channelId)
Builds a URI that points to a specific channel.
|
static Uri |
buildChannelUriForPassthroughInput(String inputId)
Build a special channel URI intended to be used with pass-through inputs.
|
static String |
buildInputId(ComponentName name)
Builds an ID that uniquely identifies a TV input service.
|
static Uri |
buildProgramsUriForChannel(long channelId)
Builds a URI that points to all programs on a given channel.
|
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.
|
static Uri |
buildProgramsUriForChannel(Uri channelUri)
Builds a URI that points to all programs on a given channel.
|
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.
|
static Uri |
buildProgramUri(long programId)
Builds a URI that points to a specific program.
|
static Uri |
buildRecordedProgramUri(long recordedProgramId)
Builds a URI that points to a specific recorded program.
|
static Uri |
buildWatchedProgramUri(long watchedProgramId)
Builds a URI that points to a specific program the user watched.
|
static boolean |
isChannelUri(Uri uri)
Returns
true , if uri is a channel URI. |
static boolean |
isChannelUriForPassthroughInput(Uri uri)
Returns
true , if uri is a channel URI for a pass-through input. |
static boolean |
isChannelUriForTunerInput(Uri uri)
Returns
true , if uri is a channel URI for a tuner input. |
static boolean |
isProgramUri(Uri uri)
Returns
true , if uri is a program URI. |
public static final String AUTHORITY
public static final String PERMISSION_READ_TV_LISTINGS
public static final String PARAM_INPUT
public static final String PARAM_CHANNEL
public static final String PARAM_START_TIME
public static final String PARAM_END_TIME
public static final String PARAM_BROWSABLE_ONLY
public static final String PARAM_CANONICAL_GENRE
public static final String buildInputId(ComponentName name)
name
- The ComponentName
of the TV input service to build ID for.public static final Uri buildChannelUri(long channelId)
channelId
- The ID of the channel to point to.public static final Uri buildChannelUriForPassthroughInput(String inputId)
inputId
- The ID of the pass-through input to build a channels URI for.TvInputInfo.isPassthroughInput()
public static final Uri buildChannelLogoUri(long channelId)
TvContract.Channels.Logo
.channelId
- The ID of the channel whose logo is pointed to.public static final Uri buildChannelLogoUri(Uri channelUri)
TvContract.Channels.Logo
.channelUri
- The URI of the channel whose logo is pointed to.public static final Uri buildChannelsUriForInput(String inputId)
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 Uri buildChannelsUriForInput(String inputId, boolean browsableOnly)
inputId
- The ID of the TV input to build a channels URI for. If null
, builds a
URI for all the TV inputs.browsableOnly
- If set to true
the URI points to only browsable channels. If set
to false
the URI points to all channels regardless of whether they are
browsable or not.public static final Uri buildChannelsUriForInput(String inputId, String genre, boolean browsableOnly)
inputId
- The ID of the TV input to build a channels URI for. If null
, builds a
URI for all the TV inputs.genre
- TvContract.Programs.Genres
to search. If null
, builds a URI for all genres.browsableOnly
- If set to true
the URI points to only browsable channels. If set
to false
the URI points to all channels regardless of whether they are
browsable or not.public static final Uri buildProgramUri(long programId)
programId
- The ID of the program to point to.public static final Uri buildProgramsUriForChannel(long channelId)
channelId
- The ID of the channel to return programs for.public static final Uri buildProgramsUriForChannel(Uri channelUri)
channelUri
- The URI of the channel to return programs for.public static final Uri buildProgramsUriForChannel(long channelId, long startTime, long endTime)
channelId
- The ID of the channel to return programs for.startTime
- The start time used to filter programs. The returned programs should have
TvContract.Programs.COLUMN_END_TIME_UTC_MILLIS
that is greater than this time.endTime
- The end time used to filter programs. The returned programs should have
TvContract.Programs.COLUMN_START_TIME_UTC_MILLIS
that is less than this time.public static final Uri buildProgramsUriForChannel(Uri channelUri, long startTime, long endTime)
channelUri
- The URI of the channel to return programs for.startTime
- The start time used to filter programs. The returned programs should have
TvContract.Programs.COLUMN_END_TIME_UTC_MILLIS
that is greater than this time.endTime
- The end time used to filter programs. The returned programs should have
TvContract.Programs.COLUMN_START_TIME_UTC_MILLIS
that is less than this time.public static final Uri buildRecordedProgramUri(long recordedProgramId)
recordedProgramId
- The ID of the recorded program to point to.public static final Uri buildWatchedProgramUri(long watchedProgramId)
watchedProgramId
- The ID of the watched program to point to.public static final boolean isChannelUri(Uri uri)
true
, if uri
is a channel URI.public static final boolean isChannelUriForTunerInput(Uri uri)
true
, if uri
is a channel URI for a tuner input.public static final boolean isChannelUriForPassthroughInput(Uri uri)
true
, if uri
is a channel URI for a pass-through input.public static final boolean isProgramUri(Uri uri)
true
, if uri
is a program URI.