WatchNextProgram

public final class WatchNextProgram
extends Object

java.lang.Object
   ↳ androidx.tvprovider.media.tv.WatchNextProgram


A convenience class to access TvContractCompat.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 classes

class WatchNextProgram.Builder

This Builder class simplifies the creation of a WatchNextProgram object. 

Constants

int WATCH_NEXT_TYPE_UNKNOWN

The unknown watch next type.

Public methods

boolean equals(Object other)
static WatchNextProgram fromCursor(Cursor cursor)

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

String[] getAudioLanguages()
String getAuthor()
int getAvailability()
String[] getCanonicalGenres()
String getContentId()
TvContentRating[] getContentRatings()
String getDescription()
int getDurationMillis()
long getEndTimeUtcMillis()
String getEpisodeNumber()
String getEpisodeTitle()
String getGenre()
long getId()
Intent getIntent()
Uri getIntentUri()
long getInteractionCount()
int getInteractionType()
byte[] getInternalProviderDataByteArray()
Long getInternalProviderFlag1()
Long getInternalProviderFlag2()
Long getInternalProviderFlag3()
Long getInternalProviderFlag4()
String getInternalProviderId()
int getItemCount()
long getLastEngagementTimeUtcMillis()
int getLastPlaybackPositionMillis()
String getLogoContentDescription()
Uri getLogoUri()
String getLongDescription()
String getOfferPrice()
int getPosterArtAspectRatio()
Uri getPosterArtUri()
Uri getPreviewAudioUri()
Uri getPreviewVideoUri()
String getReleaseDate()
String getReviewRating()
int getReviewRatingStyle()
String getSeasonNumber()
String getSeasonTitle()
String getSeriesId()
long getStartTimeUtcMillis()
String getStartingPrice()
int getThumbnailAspectRatio()
Uri getThumbnailUri()
String getTitle()
int getTvSeriesItemType()
int getType()
int getVideoHeight()
int getVideoWidth()
int getWatchNextType()
boolean hasAnyUpdatedValues(WatchNextProgram update)

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

int hashCode()
boolean isBrowsable()
boolean isLive()
boolean isSearchable()
boolean isTransient()
ContentValues toContentValues()
String toString()

Inherited methods

Constants

WATCH_NEXT_TYPE_UNKNOWN

public static final int WATCH_NEXT_TYPE_UNKNOWN

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

Constant Value: -1 (0xffffffff)

Public methods

equals

public boolean equals (Object other)

Parameters
other Object

Returns
boolean

fromCursor

public static WatchNextProgram fromCursor (Cursor cursor)

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

Parameters
cursor Cursor: A row from the TV Input Framework database.

Returns
WatchNextProgram A Program with the values taken from the cursor.

getAudioLanguages

public String[] getAudioLanguages ()

Returns
String[] The audio languages for the program.

getAuthor

public String getAuthor ()

Returns
String The author for the program.

getAvailability

public int getAvailability ()

Returns
int The availability of the program.

getCanonicalGenres

public String[] getCanonicalGenres ()

Returns
String[] The canonical genre for the program.

getContentId

public String getContentId ()

Returns
String The content ID for the program.

getContentRatings

public TvContentRating[] getContentRatings ()

Returns
TvContentRating[] The content rating for the program.

getDescription

public String getDescription ()

Returns
String The short description for the program.

getDurationMillis

public int getDurationMillis ()

Returns
int The duration of the program in millis.

getEndTimeUtcMillis

public long getEndTimeUtcMillis ()

Returns
long The end time for the program.

getEpisodeNumber

public String getEpisodeNumber ()

Returns
String The episode display number for the program.

getEpisodeTitle

public String getEpisodeTitle ()

Returns
String The episode title for the program.

getGenre

public String getGenre ()

Returns
String The genre for the program.

getId

public long getId ()

Returns
long The ID for the program.

See also:

getIntent

public Intent getIntent ()

Returns
Intent The intent which is launched when the program is selected.

Throws
URISyntaxException

getIntentUri

public Uri getIntentUri ()

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

getInteractionCount

public long getInteractionCount ()

Returns
long The interaction count for the program.

getInteractionType

public int getInteractionType ()

Returns
int The interaction type for the program.

getInternalProviderDataByteArray

public byte[] getInternalProviderDataByteArray ()

Returns
byte[] The internal provider data for the program.

getInternalProviderFlag1

public Long getInternalProviderFlag1 ()

Returns
Long The first internal provider flag for the program.

getInternalProviderFlag2

public Long getInternalProviderFlag2 ()

Returns
Long The second internal provider flag for the program.

getInternalProviderFlag3

public Long getInternalProviderFlag3 ()

Returns
Long The third internal provider flag for the program.

getInternalProviderFlag4

public Long getInternalProviderFlag4 ()

Returns
Long The forth internal provider flag for the program.

getInternalProviderId

public String getInternalProviderId ()

Returns
String The internal provider ID for the program.

See also: