I’m trying to access the list of Play Next apps on an Android TV. I can’t seem to find much information about it, other than how to add an item to the list. It seems I should be able to access via a content://
uri, but the function I have returns an empty array:
package com.me.myapp
import android.content.Context
import android.media.tv.TvContract
import com.google.android.mediahome.video.WatchNextProgram
fun getWatchNextPrograms(context: Context): List<WatchNextProgram> {
val programs = mutableListOf<WatchNextProgram>()
val projection = arrayOf(
TvContract.WatchNextPrograms._ID,
TvContract.WatchNextPrograms.COLUMN_TITLE,
TvContract.WatchNextPrograms.COLUMN_LOGO_URI,
)
val cursor = context.contentResolver.query(
TvContract.WatchNextPrograms.CONTENT_URI,
projection,
null,
null,
null
)
cursor?.use {
while (it.moveToNext()) {
val program = WatchNextProgram.fromCursor(it)
programs.add(program)
}
}
return programs
}
Is there a permission I am missing or something else I need to access this list?