TvContractCompat
class 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 Channels and Programs tables.
- A row in the
Channelstable 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
Programstable represents a set of data describing a TV program such as program title and start time.
Summary
Nested types |
|---|
interface TvContractCompat.BaseTvColumns : BaseColumnsCommon base for the tables of TV channels/programs. |
|
Column definitions for the TV channels table. |
|
A sub-directory of a single TV channel that represents its primary logo. |
interface TvContractCompat.PreviewProgramColumnsCommon columns for the tables of preview programs. |
class TvContractCompat.PreviewPrograms : TvContractCompat.BaseTvColumns, TvContractCompat.PreviewProgramColumnsColumn definitions for the preview TV programs table. |
|
Column definitions for the TV programs table. |
|
Canonical genres for TV programs. |
|
Column definitions for the recorded TV programs table. |
class TvContractCompat.WatchNextPrograms : TvContractCompat.BaseTvColumns, TvContractCompat.PreviewProgramColumnsColumn definitions for the "watch next" TV programs table. |
Constants |
|
|---|---|
const String! |
ACTION_INITIALIZE_PROGRAMS = "android.media.tv.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. |
const String! |
ACTION_PREVIEW_PROGRAM_ADDED_TO_WATCH_NEXT = "android.media.tv.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. |
const String! |
ACTION_PREVIEW_PROGRAM_BROWSABLE_DISABLED = "android.media.tv.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. |
const String! |
ACTION_REQUEST_CHANNEL_BROWSABLE = "android.media.tv.action.REQUEST_CHANNEL_BROWSABLE"Activity Action: sent by an application telling the system to make the given channel browsable with user interaction. |
const String! |
ACTION_WATCH_NEXT_PROGRAM_BROWSABLE_DISABLED = "android.media.tv.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. |
const String! |
AUTHORITY = "android.media.tv"The authority for the TV provider. |
const String! |
EXTRA_CHANNEL_ID = "android.media.tv.extra.CHANNEL_ID"The key for a bundle parameter containing a channel ID as a long integer |
const String! |
EXTRA_PREVIEW_PROGRAM_ID = "android.media.tv.extra.PREVIEW_PROGRAM_ID"The key for a bundle parameter containing a program ID as a long integer. |
const String! |
EXTRA_WATCH_NEXT_PROGRAM_ID = "android.media.tv.extra.WATCH_NEXT_PROGRAM_ID"The key for a bundle parameter containing a watch next program ID as a long integer. |
Public functions |
|
|---|---|
java-static Uri! |
buildChannelLogoUri(channelId: Long)Builds a URI that points to a channel logo. |
java-static Uri! |
buildChannelLogoUri(channelUri: Uri!)Builds a URI that points to a channel logo. |
java-static Uri! |
buildChannelUri(channelId: Long)Builds a URI that points to a specific channel. |
java-static Uri! |
buildChannelUriForPassthroughInput(inputId: String!)Build a special channel URI intended to be used with pass-through inputs. |
java-static Uri! |
buildChannelsUriForInput(inputId: String?)Builds a URI that points to all channels from a given TV input. |
java-static String! |
buildInputId(name: ComponentName!)Builds an ID that uniquely identifies a TV input service. |
java-static Uri! |
buildPreviewProgramUri(previewProgramId: Long)Builds a URI that points to a specific preview program. |
java-static Uri! |
buildPreviewProgramsUriForChannel(channelId: Long)Builds a URI that points to all preview programs on a given channel. |
java-static Uri! |
buildPreviewProgramsUriForChannel(channelUri: Uri!)Builds a URI that points to all preview programs on a given channel. |
java-static Uri! |
buildProgramUri(programId: Long)Builds a URI that points to a specific program. |
java-static Uri! |
buildProgramsUriForChannel(channelId: Long)Builds a URI that points to all programs on a given channel. |
java-static Uri! |
buildProgramsUriForChannel(channelUri: Uri!)Builds a URI that points to all programs on a given channel. |
java-static Uri! |
buildProgramsUriForChannel(channelId: Long, startTime: Long, endTime: Long)Builds a URI that points to programs on a specific channel whose schedules overlap with the given time frame. |
java-static Uri! |
buildProgramsUriForChannel(channelUri: Uri!, startTime: Long, endTime: Long)Builds a URI that points to programs on a specific channel whose schedules overlap with the given time frame. |
java-static Uri! |
buildRecordedProgramUri(recordedProgramId: Long)Builds a URI that points to a specific recorded program. |
java-static Uri! |
buildWatchNextProgramUri(watchNextProgramId: Long)Builds a URI that points to a specific watch next program. |
java-static Boolean |
isChannelUri(uri: Uri!)Returns |
java-static Boolean |
Returns |
java-static Boolean |
isChannelUriForTunerInput(uri: Uri!)Returns |
java-static Boolean |
isProgramUri(uri: Uri!)Returns |
java-static Boolean |
isRecordedProgramUri(uri: Uri!)Returns |
java-static Unit |
requestChannelBrowsable(context: Context!, channelId: Long)Requests to make a channel browsable. |
Constants
ACTION_INITIALIZE_PROGRAMS
const val ACTION_INITIALIZE_PROGRAMS = "android.media.tv.action.INITIALIZE_PROGRAMS": String!
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.
ACTION_PREVIEW_PROGRAM_ADDED_TO_WATCH_NEXT
const val ACTION_PREVIEW_PROGRAM_ADDED_TO_WATCH_NEXT = "android.media.tv.action.PREVIEW_PROGRAM_ADDED_TO_WATCH_NEXT": String!
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.
ACTION_PREVIEW_PROGRAM_BROWSABLE_DISABLED
const val ACTION_PREVIEW_PROGRAM_BROWSABLE_DISABLED = "android.media.tv.action.PREVIEW_PROGRAM_BROWSABLE_DISABLED": String!
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.
ACTION_REQUEST_CHANNEL_BROWSABLE
const val ACTION_REQUEST_CHANNEL_BROWSABLE = "android.media.tv.action.REQUEST_CHANNEL_BROWSABLE": String!
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 to get the result of the request.
The intent must contain the following bundle parameters:
EXTRA_CHANNEL_ID: ID for theTYPE_PREVIEWchannel as a long integer.
ACTION_WATCH_NEXT_PROGRAM_BROWSABLE_DISABLED
const val ACTION_WATCH_NEXT_PROGRAM_BROWSABLE_DISABLED = "android.media.tv.action.WATCH_NEXT_PROGRAM_BROWSABLE_DISABLED": String!
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.
AUTHORITY
const val AUTHORITY = "android.media.tv": String!
The authority for the TV provider.
EXTRA_CHANNEL_ID
const val EXTRA_CHANNEL_ID = "android.media.tv.extra.CHANNEL_ID": String!
The key for a bundle parameter containing a channel ID as a long integer
EXTRA_PREVIEW_PROGRAM_ID
const val EXTRA_PREVIEW_PROGRAM_ID = "android.media.tv.extra.PREVIEW_PROGRAM_ID": String!
The key for a bundle parameter containing a program ID as a long integer.
EXTRA_WATCH_NEXT_PROGRAM_ID
const val EXTRA_WATCH_NEXT_PROGRAM_ID = "android.media.tv.extra.WATCH_NEXT_PROGRAM_ID": String!
The key for a bundle parameter containing a watch next program ID as a long integer.
Public functions
buildChannelLogoUri
java-static fun buildChannelLogoUri(channelId: Long): Uri!
Builds a URI that points to a channel logo. See Channels.Logo.
| Parameters | |
|---|---|
channelId: Long |
The ID of the channel whose logo is pointed to. |
buildChannelLogoUri
java-static fun buildChannelLogoUri(channelUri: Uri!): Uri!
Builds a URI that points to a channel logo. See Channels.Logo.
| Parameters | |
|---|---|
channelUri: Uri! |
The URI of the channel whose logo is pointed to. |
buildChannelUri
java-static fun buildChannelUri(channelId: Long): Uri!
Builds a URI that points to a specific channel.
| Parameters | |
|---|---|
channelId: Long |
The ID of the channel to point to. |
buildChannelUriForPassthroughInput
java-static fun buildChannelUriForPassthroughInput(inputId: String!): Uri!
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. |
buildChannelsUriForInput
java-static fun buildChannelsUriForInput(inputId: String?): Uri!
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 |
buildInputId
java-static fun buildInputId(name: ComponentName!): String!
Builds an ID that uniquely identifies a TV input service.
| Parameters | |
|---|---|
name: ComponentName! |
The |
| Returns | |
|---|---|
String! |
the ID for the given TV input service. |
buildPreviewProgramUri
java-static fun buildPreviewProgramUri(previewProgramId: Long): Uri!
Builds a URI that points to a specific preview program.
| Parameters | |
|---|---|
previewProgramId: Long |
The ID of the preview program to point to. |
buildPreviewProgramsUriForChannel
java-static fun buildPreviewProgramsUriForChannel(channelId: Long): Uri!
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. |
buildPreviewProgramsUriForChannel
java-static fun buildPreviewProgramsUriForChannel(channelUri: Uri!): Uri!
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. |
buildProgramUri
java-static fun buildProgramUri(programId: Long): Uri!
Builds a URI that points to a specific program.
| Parameters | |
|---|---|
programId: Long |
The ID of the program to point to. |
buildProgramsUriForChannel
java-static fun buildProgramsUriForChannel(channelId: Long): Uri!
Builds a URI that points to all programs on a given channel.
| Parameters | |
|---|---|
channelId: Long |
The ID of the channel to return programs for. |
buildProgramsUriForChannel
java-static fun buildProgramsUriForChannel(channelUri: Uri!): Uri!
Builds a URI that points to all programs on a given channel.
| Parameters | |
|---|---|
channelUri: Uri! |
The URI of the channel to return programs for. |
buildProgramsUriForChannel
java-static fun buildProgramsUriForChannel(channelId: Long, startTime: Long, endTime: Long): Uri!
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 |
endTime: Long |
The end time used to filter programs. The returned programs should have |
buildProgramsUriForChannel
java-static fun buildProgramsUriForChannel(channelUri: Uri!, startTime: Long, endTime: Long): Uri!
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 |
endTime: Long |
The end time used to filter programs. The returned programs should have |
buildRecordedProgramUri
java-static fun buildRecordedProgramUri(recordedProgramId: Long): Uri!
Builds a URI that points to a specific recorded program.
| Parameters | |
|---|---|
recordedProgramId: Long |
The ID of the recorded program to point to. |
buildWatchNextProgramUri
java-static fun buildWatchNextProgramUri(watchNextProgramId: Long): Uri!
Builds a URI that points to a specific watch next program.
| Parameters | |
|---|---|
watchNextProgramId: Long |
The ID of the watch next program to point to. |
isChannelUri
java-static fun isChannelUri(uri: Uri!): Boolean
Returns true, if uri is a channel URI.
isChannelUriForPassthroughInput
java-static fun isChannelUriForPassthroughInput(uri: Uri!): Boolean
Returns true, if uri is a channel URI for a pass-through input.
isChannelUriForTunerInput
java-static fun isChannelUriForTunerInput(uri: Uri!): Boolean
Returns true, if uri is a channel URI for a tuner input.
isProgramUri
java-static fun isProgramUri(uri: Uri!): Boolean
Returns true, if uri is a program URI.
isRecordedProgramUri
java-static fun isRecordedProgramUri(uri: Uri!): Boolean
Returns true, if uri is a recorded program URI.
requestChannelBrowsable
java-static fun requestChannelBrowsable(context: Context!, channelId: Long): Unit
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 | |
|---|---|
COLUMN_BROWSABLE |