americosfacebook / googletv-issues

Automatically exported from code.google.com/p/googletv-issues
0 stars 0 forks source link

LG G2 GTV throws "Invalid URI: content://com.google.android.tv.provider/channel_listing" when querying provider #145

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Model: LG G2, 47"
Android Ver: 3.2
Software Ver: 03.05.03
Builder Number:
MASTER.user.20121205.140044

Steps to reproduce: 

Attempt to run the "Channel Listing Example", or other code that calls 
ContentResolver.query...

Observe ""Invalid URI: 
content://com.google.android.tv.provider/channel_listing" 

Original issue reported on code.google.com by GScharf....@gmail.com on 31 Jan 2013 at 9:43

Attachments:

GoogleCodeExporter commented 8 years ago
LogCat attached

Original comment by GScharf....@gmail.com on 31 Jan 2013 at 9:45

Attachments:

GoogleCodeExporter commented 8 years ago
Internal issue filed

Original comment by kri...@google.com on 1 Feb 2013 at 4:22

GoogleCodeExporter commented 8 years ago
Change your URI to be:

content://com.google.android.tv.provider/channel_list

Regards,

Original comment by kri...@google.com on 3 Feb 2013 at 1:36

GoogleCodeExporter commented 8 years ago
Thanks for your response. 
Testing indicates that removing the "ing" is ineffective.

The changed URI ("minus ing") fails on both the LG device, and the Sony buddy 
box.

LG device:    Invalid URI: content://com.google.android.tv.provider/channel_list
Sony device:  Invalid URI: content://com.google.android.tv.provider/channel_list

Whereas the documented URI ("plus ing") works on the Sony device, resulting in 
several hundred lines of listing like this:

Channel: 10 Callsign: GOAC010 URI: 
tv://channel/GOAC010?deviceId=irb_0&channelNumber=10
Channel: 10 Callsign: PCN URI: tv://channel/PCN?deviceId=irb_0&channelNumber=10
Channel: 100 Callsign: TVGN URI: 
tv://channel/TVGN?deviceId=irb_0&channelNumber=100

---------------------------

Also, I draw your attention to the following: 

https://developers.google.com/tv/android/docs/gtv_provider :

String constants

The following string values are used with the provider:

    provider authority: "com.google.android.tv.provider"
    channel listing table path: "channel_listing" <===============

and on the same page:

 */
Uri mProviderUri = Uri.parse("content://" + "com.google.android.tv.provider" + 
"/" + "channel_listing");

and finally, the example program, line 47:

http://code.google.com/p/googletv-android-samples/source/browse/ChannelChangingS
ample/src/com/example/google/android/tv/channelchanging/ChannelChangingActivity.
java#47

 // Constants for accessing the channel listing content provider.
    private static final String AUTHORITY = "com.google.android.tv.provider";

    private static final String CHANNEL_LISTING_PATH = "channel_listing";

Original comment by GScharf....@gmail.com on 3 Feb 2013 at 4:14

GoogleCodeExporter commented 8 years ago
Thank you for the detailed feedback. I am discussing with the engineering team 
now on what is happening and will update this ticket when I have more 
information.

Original comment by kri...@google.com on 3 Feb 2013 at 4:41

GoogleCodeExporter commented 8 years ago
There have been some changes in the newest version of the source code. These 
have not made their way into the sample code yet (will try to resolve that 
soon). In the interim here are the changes between the versions:

 - AUTHORITY : com.google.android.tv.provider  ->  com.google.tv.mediadevicesapp.MediaDevicesProvider
 - CHANNEL_LISTING_PATH : channel_listing  ->  channel_list
 - column name of CHANNEL_URI : channel_uri  ->  url
 - column name of CHANNEL_NAME : channel_name  ->  name
 - column name of CHANNEL_NUMBER : channel_number  ->  channelNumber
 - column name of CHANNEL_CALLSIGN : callsign  ->  subName
 - required permission : com.google.android.tv.permission.READ_CHANNELS  ->  com.google.android.tv.mediadevices.permission.READ_STREAMS 

Original comment by kri...@google.com on 4 Feb 2013 at 4:38

GoogleCodeExporter commented 8 years ago
Excellent!

All seems in good order with the LG device.

Running the same code on the Sony device results in a Null cursor being 
returned, which isn't terribly surprising. 

What test should I use to decide which flavor of code to run?

Original comment by GScharf....@gmail.com on 6 Feb 2013 at 5:19

GoogleCodeExporter commented 8 years ago
In order to test what platform version you are on you can try something like 
this:

int version = 0;
try {
    Class cl = Class.forName("com.google.android.tv.Version");
    version = cl.getField("API_LEVEL").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

*/

Original comment by kri...@google.com on 6 Feb 2013 at 10:35

GoogleCodeExporter commented 8 years ago
To test the platform substitue GTV_SDK_INT for API_LEVEL above.  Sorry about 
the typo.

Original comment by l...@google.com on 8 Feb 2013 at 1:08

GoogleCodeExporter commented 8 years ago
That did the trick, both the Sony and LG devices run appropriate code, and 
return valid results. 

And just to clarify: each version of code needs the column names associated 
with that version, so you have to setup different queries & etc in addition to 
the contentURI. 

Thank you!

Original comment by GScharf....@gmail.com on 8 Feb 2013 at 6:43

GoogleCodeExporter commented 8 years ago
Can someone please clarify this? Comment #6 states that the column names have 
changed. Comment #8 states that the column names have not changed. Which is the 
correct state of things? I'm trying to resolve an issue in our app and I am 
working this issue remotely since we do not have an OS image for Google TV 
Version 3.

Thanks,
Mike

Original comment by m...@buddytv.com on 11 Feb 2013 at 11:00