Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

PreviewChannel

open class PreviewChannel
kotlin.Any
   ↳ androidx.tvprovider.media.tv.PreviewChannel

Since API 26, all TV apps may create preview channels and publish them to the home screen. We call these App Channels (as distinct from the Live Channels row on the home screen). To help you create App Channels, the support library provides a number of classes prefixed by the word Preview-. This is a convenience class for mapping your app's content into a TvProvider Channel for publication. Use the provided Builder for creating your preview channel object. Once you create a preview channel, you can use PreviewChannelHelper to publish it and add programs to it.

Summary

Nested classes

This builder makes it easy to create a PreviewChannel object by allowing you to chain setters.

Public methods

open Boolean
equals(other: Any?)

open static PreviewChannel!
fromCursor(cursor: Cursor!)

Used by PreviewChannelHelper to transduce a TvProvider channel row into a PreviewChannel Java object.

open Intent!

open Uri!

open CharSequence!

open CharSequence!

open Long

open ByteArray!

open Long!

open Long!

open Long!

open Long!

open String!

open Bitmap!
getLogo(context: Context!)

This method should be called on a worker thread since decoding Bitmap is an expensive operation and therefore should not be performed on the main thread.

open String!

open String!

open Boolean

Indicates whether some other PreviewChannel has any set attribute that is different from this PreviewChannel's respective attributes.

open Int

open Boolean

open String

Public methods

equals

open fun equals(other: Any?): Boolean

fromCursor

open static fun fromCursor(cursor: Cursor!): PreviewChannel!

Used by PreviewChannelHelper to transduce a TvProvider channel row into a PreviewChannel Java object. You never need to use this method unless you want to convert database rows to PreviewChannel objects yourself.

This method assumes the cursor was obtained using .PreviewChannel.Columns#PROJECTION. This way, all indices are known beforehand.
Parameters
cursor Cursor!: a cursor row from the TvProvider
Return
PreviewChannel!: a PreviewChannel whose values come from the cursor row

getAppLinkIntent

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

getAppLinkIntentUri

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

getDescription

open fun getDescription(): CharSequence!
Return
CharSequence!: The value of Channels#COLUMN_DESCRIPTION for the channel. A short text explaining what this channel contains.

getDisplayName

open fun getDisplayName(): CharSequence!
Return
CharSequence!: The name users see when this channel appears on the home screen

getId

open fun getId(): Long
Return
Long: the ID the system assigns to this preview channel upon publication.

getInternalProviderDataByteArray

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

getInternalProviderFlag1

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

getInternalProviderFlag2

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

getInternalProviderFlag3

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

getInternalProviderFlag4

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

getInternalProviderId

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

getLogo

@WorkerThread open fun getLogo(context: Context!): Bitmap!

This method should be called on a worker thread since decoding Bitmap is an expensive operation and therefore should not be performed on the main thread.

Return
Bitmap!: The logo associated with this preview channel

getPackageName

open fun getPackageName(): String!
Return
String!: package name of the app that created this channel

getType

open fun getType(): String!
Return
String!: what type of channel this is. For preview channels, the type is always TvContractCompat.Channels.TYPE_PREVIEW

hasAnyUpdatedValues

open fun hasAnyUpdatedValues(update: PreviewChannel!): Boolean

Indicates whether some other PreviewChannel has any set attribute that is different from this PreviewChannel's respective attributes. An attribute is considered "set" if its key is present in the ContentValues vector.

hashCode

open fun hashCode(): Int

isBrowsable

open fun isBrowsable(): Boolean
Return
Boolean: The value of Channels#COLUMN_BROWSABLE for the channel. A preview channel is BROWABLE when it is visible on the TV home screen.

toString

open fun toString(): String