Android的电视:得到的频道列表 [英] Android Tv: get list of channels

查看:1290
本文介绍了Android的电视:得到的频道列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了androidtv样本-投入,所以我可以伪造一些电视的投入,并有一些渠道,我想获得有关渠道,但是,当我查询来获取信息,我得到一个空的游标的信息。

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.provierts.tv.permission.ACCES_ALL_EPG_DATA"/>

在此先感谢!

推荐答案

你用什么样的权限?

如果您的应用程序不systemOrSignature,只能从查询访问您的频道和节目的电视供应商。被过滤你的包名你正在做的查询。

If your application isn't systemOrSignature, 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.

我想,你可以从一个渠道获取的信息被限制到什么是TvInputInfo访问。

I guess that the information you can retrieve from a channel are restricted to what is accessible from TvInputInfo.

这篇关于Android的电视:得到的频道列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆