The second Android 11 Developer Preview is now available, test it out and share your feedback.

Add programs to the Watch Next channel

The Watch Next channel is the second row that appears in the home screen, after the apps row. The system creates and maintains this channel. Your app can add programs to the Watch Next channel: programs that the user marked as interesting, stopped watching in the middle, or that are related to the content the user is watching (like the next episode in a series or next season of a show).

The Watch Next channel has some constraints: your app cannot move, remove, or hide the Watch Next channel's row.

Steps

Inserting programs into the Watch Next channel is similar to inserting programs into your own channel. See the following sections for details specific to Watch Next.

When inserting content into the Watch Next channel, you must follow these guidelines:

Select a type of program

There are four types of Watch Next programs. Select the appropriate type:

TypeNotes
WATCH_NEXT_TYPE_CONTINUEThe user stopped while watching content.
WATCH_NEXT_TYPE_NEXTThe next available program in a series the user is watching is available. For example, if the user is watching episode 3 of a series, the app can suggest that they watch episode 4 next.
WATCH_NEXT_TYPE_NEWNew content that clearly follows what the user is watching is now available. For example, the user is watching episode number 5 from a series and episode 6 becomes available for watching.
WATCH_NEXT_TYPE_WATCHLISTInserted by the system or the app when the user saves a program.

For more information, see Watch Next attributes.

Use the WatchNextProgram builder

Use a WatchNextProgram.Builder. For more information, see Watch Next attributes.

Kotlin

val builder = WatchNextProgram.Builder()
builder.setType(TvContractCompat.WatchNextPrograms.TYPE_CLIP)
        .setWatchNextType(TvContractCompat.WatchNextPrograms.WATCH_NEXT_TYPE_CONTINUE)
        .setLastEngagementTimeUtcMillis(time)
        .setTitle("Title")
        .setDescription("Program description")
        .setPosterArtUri(uri)
        .setIntentUri(uri)
        .setInternalProviderId(appProgramId)

val watchNextProgramUri = context.contentResolver
        .insert(TvContractCompat.WatchNextPrograms.CONTENT_URI,
                builder.build().toContentValues())

Java

WatchNextProgram.Builder builder = new WatchNextProgram.Builder();
builder.setType(TvContractCompat.WatchNextPrograms.TYPE_CLIP)
        .setWatchNextType(TvContractCompat.WatchNextPrograms.WATCH_NEXT_TYPE_CONTINUE)
        .setLastEngagementTimeUtcMillis(time)
        .setTitle("Title")
        .setDescription("Program description")
        .setPosterArtUri(uri)
        .setIntentUri(uri)
        .setInternalProviderId(appProgramId);

Uri watchNextProgramUri = context.getContentResolver()
        .insert(TvContractCompat.WatchNextPrograms.CONTENT_URI, builder.build().toContentValues());

Use TvContractCompat.buildWatchNextProgramUri(long watchNextProgramId) to create the Uri you need to update a Watch Next program.

When the user adds a program to the Watch Next channel, the system copies the program to the row. It sends the intent TvContractCompat.ACTION_PREVIEW_PROGRAM_ADDED_TO_WATCH_NEXT to notify the app that the program has been added. The intent includes two extras: the program ID that was copied and the program ID created for the program in the Watch Next channel.