belongs to Maven artifact com.android.support:support-tv-provider:28.0.0-alpha1
TvContractCompat
public
final
class
TvContractCompat
extends Object
java.lang.Object | |
↳ | android.support.media.tv.TvContractCompat |
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 TvContractCompat.Channels
and TvContractCompat.Programs
tables.
- A row in the
TvContractCompat.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
TvContractCompat.Programs
table represents a set of data describing a TV program such as program title and start time.
Summary
Nested classes | |
---|---|
interface |
TvContractCompat.BaseTvColumns
Common base for the tables of TV channels/programs. |
class |
TvContractCompat.Channels
Column definitions for the TV channels table. |
class |
TvContractCompat.PreviewPrograms
Column definitions for the preview TV programs table. |
class |
TvContractCompat.Programs
Column definitions for the TV programs table. |
class |
TvContractCompat.RecordedPrograms
Column definitions for the recorded TV programs table. |
class |
TvContractCompat.WatchNextPrograms
Column definitions for the "watch next" TV programs table. |
Constants | |
---|---|
String |
ACTION_INITIALIZE_PROGRAMS
Broadcast Action: sent to the target TV input after it is first installed to notify the input to initialize its channels and programs to the system content provider. |
String |
ACTION_PREVIEW_PROGRAM_ADDED_TO_WATCH_NEXT
Broadcast Action: sent by the system to tell the target TV input that one of its existing preview programs is added to the watch next programs table by user. |
String |
ACTION_PREVIEW_PROGRAM_BROWSABLE_DISABLED
Broadcast Action: sent by the system to tell the target TV input that one of its preview program's browsable state is disabled, i.e., it will no longer be shown to users, which, for example, might be a result of users' interaction with UI. |
String |
ACTION_REQUEST_CHANNEL_BROWSABLE
Activity Action: sent by an application telling the system to make the given channel browsable with user interaction. |
String |
ACTION_WATCH_NEXT_PROGRAM_BROWSABLE_DISABLED
Broadcast Action: sent by the system to tell the target TV input that one of its "watch next" program's browsable state is disabled, i.e., it will no longer be shown to users, which, for example, might be a result of users' interaction with UI. |
String |
AUTHORITY
The authority for the TV provider. |
String |
EXTRA_CHANNEL_ID
The key for a bundle parameter containing a channel ID as a long integer |
String |
EXTRA_PREVIEW_PROGRAM_ID
The key for a bundle parameter containing a program ID as a long integer. |
String |
EXTRA_WATCH_NEXT_PROGRAM_ID
The key for a bundle parameter containing a watch next program ID as a long integer. |
Public methods | |
---|---|
static
Uri
|
buildChannelLogoUri(Uri channelUri)
Builds a URI that points to a channel logo. |
static
Uri
|
buildChannelLogoUri(long channelId)
Builds a URI that points to a channel logo. |
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
Uri
|
buildChannelsUriForInput(String inputId)
Builds a URI that points to all channels from a given TV input. |
static
String
|
buildInputId(ComponentName name)
Builds an ID that uniquely identifies a TV input service. |
static
Uri
|
buildPreviewProgramUri(long previewProgramId)
Builds a URI that points to a specific preview program. |
static
Uri
|
buildPreviewProgramsUriForChannel(Uri channelUri)
Builds a URI that points to all preview programs on a given channel. |
static
Uri
|
buildPreviewProgramsUriForChannel(long channelId)
Builds a URI that points to all preview programs on a given channel. |
static
Uri
|
buildProgramUri(long programId)
Builds a URI that points to a specific program. |
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(long channelId)
Builds a URI that points to all programs on a given channel. |
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
|
buildRecordedProgramUri(long recordedProgramId)
Builds a URI that points to a specific recorded program. |
static
Uri
|
buildWatchNextProgramUri(long watchNextProgramId)
Builds a URI that points to a specific watch next program. |
static
boolean
|
isChannelUri(Uri uri)
Returns |
static
boolean
|
isChannelUriForPassthroughInput(Uri uri)
Returns |
static
boolean
|
isChannelUriForTunerInput(Uri uri)
Returns |
static
boolean
|
isProgramUri(Uri uri)
Returns |
static
boolean
|
isRecordedProgramUri(Uri uri)
Returns |
static
void
|
requestChannelBrowsable(Context context, long channelId)
Requests to make a channel browsable. |
Inherited methods | |
---|---|
From
class
java.lang.Object
|
Constants
ACTION_INITIALIZE_PROGRAMS
String ACTION_INITIALIZE_PROGRAMS
Broadcast Action: sent to the target TV input after it is first installed to notify the input to initialize its channels and programs to the system content provider.
Note that this intent is sent only on devices with
FEATURE_LEANBACK
enabled. Besides that, in order
to receive this intent, the target TV input must:
- Declare a broadcast receiver for this intent in its
AndroidManifest.xml
. - Declare appropriate permissions to write channel and program data in its
AndroidManifest.xml
.
Constant Value: "android.media.tv.action.INITIALIZE_PROGRAMS"
ACTION_PREVIEW_PROGRAM_ADDED_TO_WATCH_NEXT
String ACTION_PREVIEW_PROGRAM_ADDED_TO_WATCH_NEXT
Broadcast Action: sent by the system to tell the target TV input that one of its existing preview programs is added to the watch next programs table by user.
The intent must contain the following bundle parameters:
EXTRA_PREVIEW_PROGRAM_ID
: the ID of the existing preview program.EXTRA_WATCH_NEXT_PROGRAM_ID
: the ID of the new watch next program.
Constant Value: "android.media.tv.action.PREVIEW_PROGRAM_ADDED_TO_WATCH_NEXT"
ACTION_PREVIEW_PROGRAM_BROWSABLE_DISABLED
String ACTION_PREVIEW_PROGRAM_BROWSABLE_DISABLED
Broadcast Action: sent by the system to tell the target TV input that one of its preview program's browsable state is disabled, i.e., it will no longer be shown to users, which, for example, might be a result of users' interaction with UI. The input is expected to delete the preview program from the content provider.
The intent must contain the following bundle parameter:
EXTRA_PREVIEW_PROGRAM_ID
: the disabled preview program ID.
Constant Value: "android.media.tv.action.PREVIEW_PROGRAM_BROWSABLE_DISABLED"
ACTION_REQUEST_CHANNEL_BROWSABLE
String ACTION_REQUEST_CHANNEL_BROWSABLE
Activity Action: sent by an application telling the system to make the given channel
browsable with user interaction. The system may show UI to ask user to approve the channel.
This is only relevant to channels with TYPE_PREVIEW
type. Use
startActivityForResult(Intent, int)
to get the result of the request.
The intent must contain the following bundle parameters:
EXTRA_CHANNEL_ID
: ID for theTYPE_PREVIEW
channel as a long integer.
Constant Value: "android.media.tv.action.REQUEST_CHANNEL_BROWSABLE"
ACTION_WATCH_NEXT_PROGRAM_BROWSABLE_DISABLED
String ACTION_WATCH_NEXT_PROGRAM_BROWSABLE_DISABLED
Broadcast Action: sent by the system to tell the target TV input that one of its "watch next" program's browsable state is disabled, i.e., it will no longer be shown to users, which, for example, might be a result of users' interaction with UI. The input is expected to delete the "watch next" program from the content provider.
The intent must contain the following bundle parameter:
EXTRA_WATCH_NEXT_PROGRAM_ID
: the disabled "watch next" program ID.
Constant Value: "android.media.tv.action.WATCH_NEXT_PROGRAM_BROWSABLE_DISABLED"
AUTHORITY
String AUTHORITY
The authority for the TV provider.
Constant Value: "android.media.tv"
EXTRA_CHANNEL_ID
String EXTRA_CHANNEL_ID
The key for a bundle parameter containing a channel ID as a long integer
Constant Value: "android.media.tv.extra.CHANNEL_ID"
EXTRA_PREVIEW_PROGRAM_ID
String EXTRA_PREVIEW_PROGRAM_ID
The key for a bundle parameter containing a program ID as a long integer.
Constant Value: "android.media.tv.extra.PREVIEW_PROGRAM_ID"
EXTRA_WATCH_NEXT_PROGRAM_ID
String EXTRA_WATCH_NEXT_PROGRAM_ID
The key for a bundle parameter containing a watch next program ID as a long integer.
Constant Value: "android.media.tv.extra.WATCH_NEXT_PROGRAM_ID"
Public methods
buildChannelLogoUri
Uri buildChannelLogoUri (Uri channelUri)
Builds a URI that points to a channel logo. See TvContractCompat.Channels.Logo
.
Parameters | |
---|---|
channelUri |
Uri : The URI of the channel whose logo is pointed to.
|
Returns | |
---|---|
Uri |
buildChannelLogoUri
Uri buildChannelLogoUri (long channelId)
Builds a URI that points to a channel logo. See TvContractCompat.Channels.Logo
.
Parameters | |
---|---|
channelId |
long : The ID of the channel whose logo is pointed to.
|
Returns | |
---|---|
Uri |
buildChannelUri
Uri buildChannelUri (long channelId)
Builds a URI that points to a specific channel.
Parameters | |
---|---|
channelId |
long : The ID of the channel to point to.
|
Returns | |
---|---|
Uri |
buildChannelUriForPassthroughInput
Uri buildChannelUriForPassthroughInput (String inputId)
Build a special channel URI intended to be used with pass-through inputs. (e.g. HDMI)
Parameters | |
---|---|
inputId |
String : The ID of the pass-through input to build a channels URI for.
|
Returns | |
---|---|
Uri |
buildChannelsUriForInput
Uri buildChannelsUriForInput (String inputId)
Builds a URI that points to all channels from a given TV input.
Parameters | |
---|---|
inputId |
String : The ID of the TV input to build a channels URI for. If null , builds a
URI for all the TV inputs.
|
Returns | |
---|---|
Uri |
buildInputId
String buildInputId (ComponentName name)
Builds an ID that uniquely identifies a TV input service.
Parameters | |
---|---|
name |
ComponentName : The ComponentName of the TV input service to build ID for. |
Returns | |
---|---|
String |
the ID for the given TV input service. |
buildPreviewProgramUri
Uri buildPreviewProgramUri (long previewProgramId)
Builds a URI that points to a specific preview program.
Parameters | |
---|---|
previewProgramId |
long : The ID of the preview program to point to.
|
Returns | |
---|---|
Uri |
buildPreviewProgramsUriForChannel
Uri buildPreviewProgramsUriForChannel (Uri channelUri)
Builds a URI that points to all preview programs on a given channel.
Parameters | |
---|---|
channelUri |
Uri : The URI of the channel to return preview programs for.
|
Returns | |
---|---|
Uri |
buildPreviewProgramsUriForChannel
Uri buildPreviewProgramsUriForChannel (long channelId)
Builds a URI that points to all preview programs on a given channel.
Parameters | |
---|---|
channelId |
long : The ID of the channel to return preview programs for.
|
Returns | |
---|---|
Uri |
buildProgramUri
Uri buildProgramUri (long programId)
Builds a URI that points to a specific program.
Parameters | |
---|---|
programId |
long : The ID of the program to point to.
|
Returns | |
---|---|
Uri |
buildProgramsUriForChannel
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.
Parameters | |
---|---|
channelId |
long : The ID of the channel to return programs for. |
startTime |
long : The start time used to filter programs. The returned programs should have
COLUMN_END_TIME_UTC_MILLIS that is greater than this time. |
endTime |
long : The end time used to filter programs. The returned programs should have
COLUMN_START_TIME_UTC_MILLIS that is less than this time.
|
Returns | |
---|---|
Uri |
buildProgramsUriForChannel
Uri buildProgramsUriForChannel (long channelId)
Builds a URI that points to all programs on a given channel.
Parameters | |
---|---|
channelId |
long : The ID of the channel to return programs for.
|
Returns | |
---|---|
Uri |
buildProgramsUriForChannel
Uri buildProgramsUriForChannel (Uri channelUri)
Builds a URI that points to all programs on a given channel.
Parameters | |
---|---|
channelUri |
Uri : The URI of the channel to return programs for.
|
Returns | |
---|---|
Uri |
buildProgramsUriForChannel
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.
Parameters | |
---|---|
channelUri |
Uri : The URI of the channel to return programs for. |
startTime |
long : The start time used to filter programs. The returned programs should have
COLUMN_END_TIME_UTC_MILLIS that is greater than this time. |
endTime |
long : The end time used to filter programs. The returned programs should have
COLUMN_START_TIME_UTC_MILLIS that is less than this time.
|
Returns | |
---|---|
Uri |
buildRecordedProgramUri
Uri buildRecordedProgramUri (long recordedProgramId)
Builds a URI that points to a specific recorded program.
Parameters | |
---|---|
recordedProgramId |
long : The ID of the recorded program to point to.
|
Returns | |
---|---|
Uri |
buildWatchNextProgramUri
Uri buildWatchNextProgramUri (long watchNextProgramId)
Builds a URI that points to a specific watch next program.
Parameters | |
---|---|
watchNextProgramId |
long : The ID of the watch next program to point to.
|
Returns | |
---|---|
Uri |
isChannelUri
boolean isChannelUri (Uri uri)
Returns true
, if uri
is a channel URI.
Parameters | |
---|---|
uri |
Uri |
Returns | |
---|---|
boolean |
isChannelUriForPassthroughInput
boolean isChannelUriForPassthroughInput (Uri uri)
Returns true
, if uri
is a channel URI for a pass-through input.
Parameters | |
---|---|
uri |
Uri |
Returns | |
---|---|
boolean |
isChannelUriForTunerInput
boolean isChannelUriForTunerInput (Uri uri)
Returns true
, if uri
is a channel URI for a tuner input.
Parameters | |
---|---|
uri |
Uri |
Returns | |
---|---|
boolean |
isProgramUri
boolean isProgramUri (Uri uri)
Returns true
, if uri
is a program URI.
Parameters | |
---|---|
uri |
Uri |
Returns | |
---|---|
boolean |
isRecordedProgramUri
boolean isRecordedProgramUri (Uri uri)
Returns true
, if uri
is a recorded program URI.
Parameters | |
---|---|
uri |
Uri |
Returns | |
---|---|
boolean |
requestChannelBrowsable
void requestChannelBrowsable (Context context, long channelId)
Requests to make a channel browsable.
Once called, the system will review the request and make the channel browsable based on
its policy. The first request from a package is guaranteed to be approved. This is only
relevant to channels with TYPE_PREVIEW
type.
No-op on devices prior to O
.
Parameters | |
---|---|
context |
Context : The context for accessing content provider. |
channelId |
long : The channel ID to be browsable. |
See also:
Interfaces
Classes
- Channel
- Channel.Builder
- ChannelLogoUtils
- PreviewProgram
- PreviewProgram.Builder
- Program
- Program.Builder
- R
- R.attr
- R.bool
- R.color
- R.dimen
- R.drawable
- R.id
- R.integer
- R.layout
- R.string
- R.style
- R.styleable
- TvContractCompat
- TvContractCompat.Channels
- TvContractCompat.Channels.Logo
- TvContractCompat.PreviewPrograms
- TvContractCompat.Programs
- TvContractCompat.Programs.Genres
- TvContractCompat.RecordedPrograms
- TvContractCompat.WatchNextPrograms
- WatchNextProgram
- WatchNextProgram.Builder
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-04-11 UTC.