Android Core

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.

android.hardware.type.television

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.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Back to top button