在LG G2 Google TV上,任何查询频道列表提供商的尝试都会引发此异常:“无效的URI:content://com.google.android.tv.provider/channel_listing”
官方频道改变示例以及我自己的代码都是如此,我已经证明这两个代码都适用于索尼GTV好友盒。
我在这里遗漏了什么吗?是不是有一些我不知道的LG酱?或者这是一个简单明了的LG小虫?
答案 0 :(得分:4)
更新:将您的uri更改为:
内容://com.google.tv.mediadevicesapp.ChannelListingProvider/channel_listing
此外:
将com.google.android.tv.permission.READ_CHANNELS所需的权限更改为com.google.android.tv.mediadevices.permission.READ_STREAMS
您获得的数据也会有所不同:
“channel_uri”更改为“url” “channel_name”已更改为“name” “channel_number”更改为“channelNumber” “callsign”已更改为“subName”
int version = 0;
try {
Class cl = Class.forName("com.google.android.tv.Version");
version = cl.getField("GTV_SDK_INT").getInt(null); }
catch (Exception ex) {}
String contentUri;
if (version == 0) {
// We're on old (Pre-V3 GoogleTV)
contentUri = "content://com.google.android.tv.provider/channel_listing";
} else {
// We're on V3 or newer.
contentUri = "content://com.google.tv.mediadevicesapp.ChannelListingProvider/channel_listing";
// or, if you're using the framework library:
// Uri contentUri = com.google.android.tv.provider.ChannelListingContract.Channels.CHANNEL_LISTING_URI
}
/*
Column names are:
callsign
channel_name
channel_number
channel_uri
data_source
*/
答案 1 :(得分:0)