The Android Developer Challenge is back! Submit your idea before December 2.

Channel

class Channel
kotlin.Any
   ↳ androidx.tvprovider.media.tv.Channel

A convenience class to access TvContractCompat.Channels entries in the system content provider.

This class makes it easy to insert or retrieve a channel from the system content provider, which is defined in TvContractCompat.

Usage example when inserting a channel:

Channel channel = new Channel.Builder()
          .setDisplayName("Channel Name")
          .setDescription("Channel description")
          .setType(Channels.TYPE_PREVIEW)
          // Set more attributes...
          .build();
  Uri channelUri = getContentResolver().insert(Channels.CONTENT_URI, channel.toContentValues());
  

Usage example when retrieving a channel:

Channel channel;
  try (Cursor cursor = resolver.query(channelUri, null, null, null, null)) {
      if (cursor != null && cursor.getCount() != 0) {
          cursor.moveToNext();
          channel = Channel.fromCursor(cursor);
      }
  }
  

Usage example when updating an existing channel:

Channel updatedChannel = new Channel.Builder(channel)
          .setDescription("New channel description")
          .build();
  getContentResolver().update(TvContractCompat.buildChannelUri(updatedChannel.getId()),
          updatedChannel.toContentValues(), null, null);
  

Usage example when deleting a channel:

getContentResolver().delete(
          TvContractCompat.buildChannelUri(existingChannel.getId()), null, null);
  

Summary

Nested classes

The builder class that makes it easy to chain setters to create a Channel object.

Public methods

Boolean
equals(other: Any?)

static Channel!
fromCursor(cursor: Cursor!)

Creates a Channel object from a cursor including the fields defined in Channels.

Int

Uri!

Intent!

Uri!

Uri!

String!

Int

String!

String!

String!

Long

String!

ByteArray!

Long!

Long!

Long!

Long!

String!

String!

Int

String!

Int

String!

String!

Int

String!

String!

Int

Boolean

Boolean

Boolean

Boolean

ContentValues!

String

Public methods

equals

fun equals(other: Any?): Boolean

fromCursor

static fun fromCursor(cursor: Cursor!): Channel!

Creates a Channel object from a cursor including the fields defined in Channels.

Parameters
cursor Cursor!: A row from the TV Input Framework database.
Return
Channel!: A channel with the values taken from the cursor.

getAppLinkColor

fun getAppLinkColor(): Int
Return
Int: The value of Channels#COLUMN_APP_LINK_COLOR for the channel.

getAppLinkIconUri

fun getAppLinkIconUri(): Uri!
Return
Uri!: The value of Channels#COLUMN_APP_LINK_ICON_URI for the channel.

getAppLinkIntent

fun getAppLinkIntent(): Intent!
Return
Intent!: The value of Channels#COLUMN_APP_LINK_INTENT_URI for the program.

getAppLinkIntentUri

fun getAppLinkIntentUri(): Uri!
Return
Uri!: The value of Channels#COLUMN_APP_LINK_INTENT_URI for the channel.

getAppLinkPosterArtUri

fun getAppLinkPosterArtUri(): Uri!
Return
Uri!: The value of Channels#COLUMN_APP_LINK_POSTER_ART_URI for the channel.

getAppLinkText

fun getAppLinkText(): String!
Return
String!: The value of Channels#COLUMN_APP_LINK_TEXT for the channel.

getConfigurationDisplayOrder

fun getConfigurationDisplayOrder(): Int
Return
Int: The value of Channels#COLUMN_CONFIGURATION_DISPLAY_ORDER for the channel.

getDescription

fun getDescription(): String!
Return
String!: The value of Channels#COLUMN_DESCRIPTION for the channel.

getDisplayName

fun getDisplayName(): String!
Return
String!: The value of Channels#COLUMN_DISPLAY_NAME for the channel.

getDisplayNumber

fun getDisplayNumber(): String!
Return
String!: The value of Channels#COLUMN_DISPLAY_NUMBER for the channel.

getId

fun getId(): Long
Return
Long: The value of Channels#_ID for the channel.

getInputId

fun getInputId(): String!
Return
String!: The value of Channels#COLUMN_INPUT_ID for the channel.

getInternalProviderDataByteArray

fun getInternalProviderDataByteArray(): ByteArray!
Return
ByteArray!: The value of Channels#COLUMN_INTERNAL_PROVIDER_DATA for the channel.

getInternalProviderFlag1

fun getInternalProviderFlag1(): Long!
Return
Long!: The value of Channels#COLUMN_INTERNAL_PROVIDER_FLAG1 for the channel.

getInternalProviderFlag2

fun getInternalProviderFlag2(): Long!
Return
Long!: The value of Channels#COLUMN_INTERNAL_PROVIDER_FLAG2 for the channel.

getInternalProviderFlag3

fun getInternalProviderFlag3(): Long!
Return
Long!: The value of Channels#COLUMN_INTERNAL_PROVIDER_FLAG3 for the channel.

getInternalProviderFlag4

fun getInternalProviderFlag4(): Long!
Return
Long!: The value of Channels#COLUMN_INTERNAL_PROVIDER_FLAG4 for the channel.

getInternalProviderId

fun getInternalProviderId(): String!
Return
String!: The value of Channels#COLUMN_INTERNAL_PROVIDER_ID for the channel.

getNetworkAffiliation

fun getNetworkAffiliation(): String!
Return
String!: The value of Channels#COLUMN_NETWORK_AFFILIATION for the channel.

getOriginalNetworkId

fun getOriginalNetworkId(): Int
Return
Int: The value of Channels#COLUMN_ORIGINAL_NETWORK_ID for the channel.

getPackageName

fun getPackageName(): String!
Return
String!: The value of Channels#COLUMN_PACKAGE_NAME for the channel.

getServiceId

fun getServiceId(): Int
Return
Int: The value of Channels#COLUMN_SERVICE_ID for the channel.

getServiceType

fun getServiceType(): String!
Return
String!: The value of Channels#COLUMN_SERVICE_TYPE for the channel.

Returns Channels#SERVICE_TYPE_AUDIO, Channels#SERVICE_TYPE_AUDIO_VIDEO, or Channels#SERVICE_TYPE_OTHER.

getSystemChannelKey

fun getSystemChannelKey(): String!
Return
String!: The value of Channels#COLUMN_SYSTEM_CHANNEL_KEY for the channel.

getTransportStreamId

fun getTransportStreamId(): Int
Return
Int: The value of Channels#COLUMN_TRANSPORT_STREAM_ID for the channel.

getType

fun getType(): String!
Return
String!: The value of Channels#COLUMN_TYPE for the channel.

getVideoFormat

fun getVideoFormat(): String!
Return
String!: The value of Channels#COLUMN_VIDEO_FORMAT for the channel.

hashCode

fun hashCode(): Int

isBrowsable

fun isBrowsable(): Boolean
Return
Boolean: The value of Channels#COLUMN_BROWSABLE for the channel.

isLocked

fun isLocked(): Boolean
Return
Boolean: The value of Channels#COLUMN_LOCKED for the channel.

isSearchable

fun isSearchable(): Boolean
Return
Boolean: The value of Channels#COLUMN_SEARCHABLE for the channel.

isTransient

fun isTransient(): Boolean
Return
Boolean: The value of Channels#COLUMN_TRANSIENT for the channel.

toContentValues

fun toContentValues(): ContentValues!
Return
ContentValues!: The fields of the Channel in the ContentValues format to be easily inserted into the TV Input Framework database.

toString

fun toString(): String