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.

About these ads
This entry was posted in android, googletv. Bookmark the permalink.

One Response to Detecting Television Feature on Android

  1. androidbethy says:

    Reblogged this on Android Bethy.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s