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.

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

JPA Mini Book

Learn how to leverage the power of JPA in order to create robust and flexible Java applications. With this Mini Book, you will get introduced to JPA and smoothly transition to more advanced concepts.

JVM Troubleshooting Guide

The Java virtual machine is really the foundation of any Java EE platform. Learn how to master it with this advanced guide!

Given email address is already subscribed, thank you!
Oops. Something went wrong. Please try again later.
Please provide a valid email address.
Thank you, your sign-up request was successful! Please check your e-mail inbox.
Please complete the CAPTCHA.
Please fill in the required fields.

Leave a Reply


four × 4 =



Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy | Contact
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.
Do you want to know how to develop your skillset and become a ...
Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

Get ready to Rock!
You can download the complementary eBooks using the links below:
Close