Is there a way for an Android app to tell in the Java code if it is running on GoogleTV vs tablets or phones?
You can ask the package manager:
/**
* Test if this device is a Google TV.
*
* See 32:00 in "Google I/O 2011: Building Android Apps for Google TV"
* http://www.youtube.com/watch?v=CxLL-sR6XfM
*
* @return true if google tv
*/
public static boolean isGoogleTV(Context context) {
final PackageManager pm = context.getPackageManager();
return pm.hasSystemFeature("com.google.android.tv");
}
Plus this manifest line:
<uses-feature android:name="com.google.android.tv" android:required="false" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With