Android Tv: Get Channel List

I set the input for androidtv-sample so that I can fake some Tv inputs and have some channels, and I wanted to get information about these channels, however, when I request to get this information, I get empty cursors.

What I have tried so far:

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 already added use-permissions and I checked that the tv input does not go 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.provierts.tv.permission.ACCES_ALL_EPG_DATA"/>

Thanks in advance!

+4
source share
2 answers

What resolution are you using?

systemOrSignature, . , , .

, , , , TvInputInfo.

+1

"ru.android.providers.tv.xxx" EPG, , .apk! TvInput, , , tvInput ( , - , ;-)). Android Studio ( "BUILD", "Generate Signed APK" ) . apk

0

All Articles