WatchNextProgram

public final class WatchNextProgram


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

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

Usage example when inserting a "watch next" program:

WatchNextProgram watchNextProgram = new WatchNextProgram.Builder()
        .setWatchNextType(WatchNextPrograms.WATCH_NEXT_TYPE_CONTINUE)
        .setType(PreviewPrograms.TYPE_MOVIE)
        .setTitle("Program Title")
        .setDescription("Program Description")
        .setPosterArtUri(Uri.parse("http://example.com/poster_art.png"))
        // Set more attributes...
        .build();
Uri watchNextProgramUri = getContentResolver().insert(WatchNextPrograms.CONTENT_URI,
        watchNextProgram.toContentValues());

Usage example when retrieving a "watch next" program:

WatchNextProgram watchNextProgram;
try (Cursor cursor = resolver.query(watchNextProgramUri, null, null, null, null)) {
    if (cursor != null && cursor.getCount() != 0) {
        cursor.moveToNext();
        watchNextProgram = WatchNextProgram.fromCursor(cursor);
    }
}

Usage example when updating an existing "watch next" program:

WatchNextProgram updatedProgram = new WatchNextProgram.Builder(watchNextProgram)
        .setLastEngagementTimeUtcMillis(System.currentTimeMillis())
        .build();
getContentResolver().update(TvContractCompat.buildWatchNextProgramUri(updatedProgram.getId()),
        updatedProgram.toContentValues(), null, null);

Usage example when deleting a "watch next" program:

getContentResolver().delete(TvContractCompat.buildWatchNextProgramUri(existingProgram.getId()),
        null, null);

Summary

Nested types

public final class WatchNextProgram.Builder

This Builder class simplifies the creation of a WatchNextProgram object.

Constants

static final int

The unknown watch next type.

Public methods

boolean
equals(Object other)
static WatchNextProgram

Creates a WatchNextProgram object from a cursor including the fields defined in WatchNextPrograms.

String[]
String
int
String[]
String
TvContentRating[]
String
int
long
String
String
String
long
Intent
Uri
long
int
byte[]
Long
Long
Long
Long
String
int
long
int
String
Uri
String
String
int
Uri
Uri
Uri
String
String
int
String
String
@Nullable String
long
String
int
Uri
String
int
int
int
int
int
boolean

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

int
boolean
boolean
boolean
boolean
ContentValues
String

Constants

WATCH_NEXT_TYPE_UNKNOWN

Added in 1.1.0-alpha02
public static final int WATCH_NEXT_TYPE_UNKNOWN = -1

The unknown watch next type. Use this type when the actual type is not known.

Public methods

equals

public boolean equals(Object other)

fromCursor

Added in 1.1.0-alpha02
public static WatchNextProgram fromCursor(Cursor cursor)

Creates a WatchNextProgram object from a cursor including the fields defined in WatchNextPrograms.

Parameters
Cursor cursor

A row from the TV Input Framework database.

Returns
WatchNextProgram

A Program with the values taken from the cursor.

getAudioLanguages

Added in 1.1.0-alpha02
public String[] getAudioLanguages()
Returns
String[]

The audio languages for the program.

getAuthor

Added in 1.1.0-alpha02
public String getAuthor()
Returns
String

The author for the program.

See also
COLUMN_AUTHOR

getAvailability

Added in 1.1.0-alpha02
public int getAvailability()
Returns
int

The availability of the program.

getCanonicalGenres

Added in 1.1.0-alpha02
public String[] getCanonicalGenres()
Returns
String[]

The canonical genre for the program.

getContentId

Added in 1.1.0-alpha02
public String getContentId()
Returns
String

The content ID for the program.

getContentRatings

Added in 1.1.0-alpha02
public TvContentRating[] getContentRatings()
Returns
TvContentRating[]

The content rating for the program.

getDescription

Added in 1.1.0-alpha02
public String getDescription()
Returns
String

The short description for the program.

getDurationMillis

Added in 1.1.0-alpha02
public int getDurationMillis()
Returns
int

The duration of the program in millis.

getEndTimeUtcMillis

Added in 1.1.0-alpha02
public long getEndTimeUtcMillis()
Returns
long

The end time for the program.

getEpisodeNumber

Added in 1.1.0-alpha02
public String getEpisodeNumber()
Returns
String

The episode display number for the program.

getEpisodeTitle

Added in 1.1.0-alpha02
public String getEpisodeTitle()
Returns
String

The episode title for the program.

getGenre

Added in 1.1.0-alpha02
public String getGenre()
Returns
String

The genre for the program.

See also
COLUMN_GENRE

getId

Added in 1.1.0-alpha02
public long getId()
Returns
long

The ID for the program.

See also
_ID

getIntent

Added in 1.1.0-alpha02
public Intent getIntent()
Returns
Intent

The intent which is launched when the program is selected.

getIntentUri

Added in 1.1.0-alpha02
public Uri getIntentUri()
Returns
Uri

The intent URI which is launched when the program is selected.

getInteractionCount

Added in 1.1.0-alpha02
public long getInteractionCount()
Returns
long

The interaction count for the program.

getInteractionType

Added in 1.1.0-alpha02
public int getInteractionType()
Returns
int

The interaction type for the program.

getInternalProviderDataByteArray

Added in 1.1.0-alpha02
public byte[] getInternalProviderDataByteArray()
Returns
byte[]

The internal provider data for the program.

getInternalProviderFlag1

Added in 1.1.0-alpha02
public Long getInternalProviderFlag1()
Returns
Long

The first internal provider flag for the program.

getInternalProviderFlag2

Added in 1.1.0-alpha02
public Long getInternalProviderFlag2()
Returns
Long

The second internal provider flag for the program.

getInternalProviderFlag3

Added in 1.1.0-alpha02
public Long getInternalProviderFlag3()
Returns
Long

The third internal provider flag for the program.

getInternalProviderFlag4

Added in 1.1.0-alpha02
public Long getInternalProviderFlag4()
Returns
Long

The forth internal provider flag for the program.

getInternalProviderId

Added in 1.1.0-alpha02
public String getInternalProviderId()
Returns
String

The internal provider ID for the program.

getItemCount

Added in 1.1.0-alpha02
public int getItemCount()
Returns
int

The item count for the program.

getLastEngagementTimeUtcMillis

Added in 1.1.0-alpha02
public long getLastEngagementTimeUtcMillis()
Returns
long

The value of COLUMN_LAST_ENGAGEMENT_TIME_UTC_MILLIS for the program.

getLastPlaybackPositionMillis

Added in 1.1.0-alpha02
public int getLastPlaybackPositionMillis()
Returns
int

The last playback position of the program in millis.

See also
TvContractCompat

.PreviewPrograms#COLUMN_LAST_PLAYBACK_POSITION_MILLIS

getLogoContentDescription

Added in 1.1.0-alpha02
public String getLogoContentDescription()
Returns
String

The logo content description for the program.

See also
TvContractCompat

.PreviewPrograms#COLUMN_LOGO_CONTENT_DESCRIPTION

COLUMN_LOGO_URI

getLogoUri

Added in 1.1.0-alpha02
public Uri getLogoUri()
Returns
Uri

The logo URI for the program.

See also
COLUMN_LOGO_URI

getLongDescription

Added in 1.1.0-alpha02
public String getLongDescription()
Returns
String

The long description for the program.

getOfferPrice

Added in 1.1.0-alpha02
public String getOfferPrice()
Returns
String

The offer price of the program.

getPosterArtAspectRatio

Added in 1.1.0-alpha02
public int getPosterArtAspectRatio()
Returns
int

The poster art aspect ratio for the program.

getPosterArtUri

Added in 1.1.0-alpha02
public Uri getPosterArtUri()
Returns
Uri

The poster art URI for the program.

getPreviewAudioUri

Added in 1.1.0-alpha02
public Uri getPreviewAudioUri()
Returns
Uri

The preview audio URI for the program.

getPreviewVideoUri

Added in 1.1.0-alpha02
public Uri getPreviewVideoUri()
Returns
Uri

The preview video URI for the program.

getReleaseDate

Added in 1.1.0-alpha02
public String getReleaseDate()
Returns
String

The release date of the program.

getReviewRating

Added in 1.1.0-alpha02
public String getReviewRating()
Returns
String

The review rating for the program.

getReviewRatingStyle

Added in 1.1.0-alpha02
public int getReviewRatingStyle()
Returns
int

The review rating style for the program.

getSeasonNumber

Added in 1.1.0-alpha02
public String getSeasonNumber()
Returns
String

The season display number for the program.

getSeasonTitle

Added in 1.1.0-alpha02
public String getSeasonTitle()
Returns
String

The season title for the program.

getSeriesId

Added in 1.1.0-alpha02
public @Nullable String getSeriesId()
Returns
@Nullable String

The series ID for the program.

See also
COLUMN_SERIES_ID

getStartTimeUtcMillis

Added in 1.1.0-alpha02
public long getStartTimeUtcMillis()
Returns
long

The start time for the program.

getStartingPrice

Added in 1.1.0-alpha02
public String getStartingPrice()
Returns
String

The starting price of the program.

getThumbnailAspectRatio

Added in 1.1.0-alpha02
public int getThumbnailAspectRatio()
Returns
int

The thumbnail aspect ratio for the program.

getThumbnailUri

Added in 1.1.0-alpha02
public Uri getThumbnailUri()
Returns
Uri

The thumbnail URI for the program.

getTitle

Added in 1.1.0-alpha02
public String getTitle()
Returns
String

The title for the program.

See also
COLUMN_TITLE

getTvSeriesItemType

Added in 1.1.0-alpha02
public int getTvSeriesItemType()
Returns
int

The TV series item type for the program.

getType

Added in 1.1.0-alpha02
public int getType()
Returns
int

The type of the program.

See also
COLUMN_TYPE

getVideoHeight

Added in 1.1.0-alpha02
public int getVideoHeight()
Returns
int

The video height for the program.

getVideoWidth

Added in 1.1.0-alpha02
public int getVideoWidth()
Returns
int

The video width for the program.

getWatchNextType

Added in 1.1.0-alpha02
public int getWatchNextType()
Returns
int

The value of COLUMN_WATCH_NEXT_TYPE for the program, or WATCH_NEXT_TYPE_UNKNOWN if it's unknown.

hasAnyUpdatedValues

Added in 1.1.0-alpha02
public boolean hasAnyUpdatedValues(WatchNextProgram update)

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

hashCode

public int hashCode()

isBrowsable

Added in 1.1.0-alpha02
public boolean isBrowsable()
Returns
boolean

Whether the program is browsable or not.

See also
COLUMN_BROWSABLE

isLive

Added in 1.1.0-alpha02
public boolean isLive()
Returns
boolean

Whether the program is live or not.

See also
COLUMN_LIVE

isSearchable

Added in 1.1.0-alpha02
public boolean isSearchable()
Returns
boolean

Whether the program is searchable or not.

isTransient

Added in 1.1.0-alpha02
public boolean isTransient()
Returns
boolean

Whether the program is transient or not.

See also
COLUMN_TRANSIENT

toContentValues

Added in 1.1.0-alpha02
public ContentValues toContentValues()
Returns
ContentValues

The fields of the Program in the ContentValues format to be easily inserted into the TV Input Framework database.

toString

public String toString()