0

Is there a way to access the TV provider that the user specified during the setup of Google TV? For example, the setup for my zipcode includes TV providers like Comcast, Dish, DirecTV, etc.

My app duplicates this setup widget because it too needs to know the user's TV provider. Instead, I'd like to ask the Google TV system for the setting the user has already made.

larham1
  • 11,736
  • 5
  • 35
  • 26

2 Answers2

1

The URI changed for the provider changed in the latest update from content://com.google.android.tv.provider/devices to content://com.google.tv.mediadevicesapp.MediaDevicesProvider/devices

 DEVICE_ID = "device_id";   // like Atsc01
 LINEUP_ID = "lineup_id";   // like TMS:OTA94043
 DEFAULT = "is_default";    // 0 or 1  -- Also changed from "default"

I'm answering this here since I mentioned it in the release note last year. Since using this is a rare use case, there is no guarantee we will support it long term.

0

You can't get the service provider info, but you can get the location. Use the "static" location provider to get a location from the zip code configured during device setup:

LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
Location location = locationManager.getLastKnownLocation("static");
Geocoder geocoder = new Geocoder(this);
Address address = null;
try {
  address = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1).get(0);
  Log.d("Zip code", address.getPostalCode());
} catch (IOException e) {
  Log.e(TAG, "Geocoder error", e);
}  

The "android.permission.ACCESS_COARSE_LOCATION" permission is required in the manifest.

Leon Nicholls
  • 4,623
  • 2
  • 16
  • 17
  • yes, we already prefill the zip in this way. still hoping for the tv provider access, however. – larham1 Mar 21 '13 at 00:52
  • There isn't an API for that. – Leon Nicholls Mar 23 '13 at 14:14
  • Please see this announcement, @Leon. https://groups.google.com/forum/#!msg/googletv-android/urjgqJO-3KE/LS4A48fHEb8J , in particular the reference: "new contract for exposing lineups for each device, MediaDeviceContract" The content provider content://com.google.android.tv.provider/devices used to work in Google TV sdk2 – larham1 Mar 23 '13 at 16:36