First of all, this is the /data/data/com.android.providers.tv/databases/tv.db
Then in my code I applied this code snippet to retrieve the channels:
TvInputManager tv = (TvInputManager)getApplicationContext().getSystemService(Context.TV_INPUT_SERVICE);
List<TvInputInfo> list = tv.getTvInputList();
ContentResolver cr = getContentResolver();
Iterator<TvInputInfo> it = list.iterator();
while(it.hasNext()) {
TvInputInfo aux = it.next();
Uri uri = TvContract.buildChannelsUriForInput(aux.getId());
Cursor cur = cr.query(uri, projection, null, null ,null);
cur.moveToFirst();
do {
val channel = Channel.fromCursor(channelCursor)
Log.d("Log", "New channel ${channel.id} : ${channel.displayName} : ${channel.packageName}"}
} while (channelCursor.moveToNext() && channelCursor.isLast.not())
}
Unfortunately, I get as input_id for TvInputInfo aux
only
com.google.android.videos/.tv.usecase.tvinput.playback.TvInputService
thus my cursor returns only 1 Channel with _id = 4
.
Despite, I did neither got the input_id's _id=22
for amazon nor _id=25
for netflix, as listed in the screenshot above, I would like to get all above shown 18 Channels.
How can I query all Channels, also those with an empty input_id
?
You get restricted by TvContract.buildChannelsUriForInput(aux.getId());
what depends on input_id. When you take TvContractCompat.Channels.CONTENT_URI
for Uri, you will get:
Uri uri = TvContractCompat.Channels.CONTENT_URI;
Cursor cur = getContentResolver().query(uri, projection, null, null ,null);
cur.moveToFirst();
do {
val channel = Channel.fromCursor(channelCursor)
Log.d("Log", "New channel ${channel.id} : ${channel.displayName} : ${channel.packageName}"}
} while (channelCursor.moveToNext())