Detecting Television Feature on Android

I wrote up a post on google plus, that may be interested to a wider audience.  If you are an android app developer and want your app to work well on a Television or set top box, you need know if you need to handle focus specially or not for these devices.  Here is one way to know when you are running on such devices.

Android has the following system feature that can be checked.


If the device has this feature you can know that that the device supports the following:

This feature defines “television” to be a typical living room television experience: displayed on a big screen, where the user is sitting far away and the dominant form of input is something like a d-pad, and generally not through touch or a mouse/pointer-device.

Why is this important. Because for D-PAD devices, like the OUYA and Google TV, one needs to be more aware of what items can have Focus and which item currently has focus. Not all Android views play well with Focus, as for a touch screen device it isn’t as important to know what currently has focus. It is critical though when designing an app that can be used effectively on a tv.

For those that need a bit of code, here is some from Serenity for Android 1.4.2 to help you out.

public static boolean isAndroidTV(Context context) {
     final PackageManager pm = context.getPackageManager();
     return pm.hasSystemFeature("android.hardware.type.television");

The above will check if the device reports that it supports the Television feature or not.

Not paying attention to what items have focus is probably the biggest useability issue your app will run into when trying to run on a non touchscreen device.


Reference: Detecting Television Feature on Android from our JCG partner David Carver at the Intellectual Cramps blog.
Related Whitepaper:

Rapid Android Development: Build Rich, Sensor-Based Applications with Processing

Create mobile apps for Android phones and tablets faster and more easily than you ever imagined

Use 'Processing', the free, award-winning, graphics-savvy language and development environment, to work with the touchscreens, hardware sensors, cameras, network transceivers, and other devices and software in the latest Android phones and tablets.

Get it Now!  

Leave a Reply

nine × = 45

Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.

Sign up for our Newsletter

20,709 insiders are already enjoying weekly updates and complimentary whitepapers! Join them now to gain exclusive access to the latest news in the Java world, as well as insights about Android, Scala, Groovy and other related technologies.

As an extra bonus, by joining you will get our brand new e-books, published by Java Code Geeks and their JCG partners for your reading pleasure! Enter your info and stay on top of things,

  • Fresh trends
  • Cases and examples
  • Research and insights
  • Two complimentary e-books