I've installed the androidtv-sample-inputs so I can fake some Tv inputs and have some channels and I wanted to get information about that channels, however, when I query to get that information I get an empty cursors.
What i've tried so far is:
TvInputManager tv = (TvInputManager)getApplicationContext().getSystemService(Context.TV_INPUT_SERVICE);
List<TvInputInfo> list = tv.getTvInputList();
String[] projection = {
TvContract.Channels._ID,
TvContract.Channels.COLUMN_DISPLAY_NUMBER
};
ContentResolver cr = getContentResolver();
Iterator<TvInputInfo> it = list.iterator();
while(it.hasNext()) {
TvInputInfo aux = it.next();
Uri uri = TvContract.buildChannelsUriForInput(aux.getId());
Log.d("TAG", uri.toString());
Log.d("TAG", aux.toString());
Cursor cur = cr.query(uri, projection, null, null ,null);
Log.d("TAG", cur.toString());
if(cur.moveToFirst()) {
Log.d("TAG", "not empty cursors");
}
}
I have already added the uses-permission and I've checked that the tv input are not pass-through.
<uses-permission android:name="com.android.providers.tv.permission.READ_EPG_DATA" />
<uses-permission android:name="com.android.providers.tv.permission.WRITE_EPG_DATA" />
<uses-permission android:name="com.android.providers.tv.permission.ACCESS_ALL_EPG_DATA"/>
Watch channels from an app or a TV tuner Most Android TVs come with a TV app where you can watchall your shows, sports, and news. To learn how to use the TV app on your TV, contact your device manufacturer. If your device does not come with a TV app, you can use the Live Channels app.
As Google TV doesn’t have channels of its own, you need to have a YouTube TV subscription to watch Live TV channels on it. You can find the list of channels on YouTube TV here.
The Android TV home screen uses Android's TvProvider APIs to manage the channels and programs that your app creates. To access the provider's data, add the following permission to your app's manifest: Note: The READ_EPG_DATA permission was deprecated in Android M (API 23) and is no longer needed.
Choose which channels you want to show up in your program guide. To return to your Live Channels stream, press the Backbutton. Watch your channels You can change channels with your remote. You can also choose a channel from your Program guide. On your Android TV, go to the Home screen. Scroll down to the "Apps" row. Select the Live Channelsapp.
What kind of permission are you using ?
If your application isn't signatureOrSystem, you can only access your own channels and programs from queries to the TV provider. All the queries you're doing are filtered on your package name.
I guess that the information you can retrieve from a channel are restricted to what is accessible from TvInputInfo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With