Android Futures: Creating Android Apps For Google TV

Google IO 2011 took place in early May in San Francisco, California. In the midst of many announcements and tons of information, Android development for Google TV did get a little coverage. As of this writing, most developers cannot yet use Google TVs as a target device for development, but this is about to change. Developers looking to get a head start can follow a few easy tips and be ready when consumers can download applications for their TVs.

Existing Google TV devices are scheduled to be upgraded to Android 3.1, a Honeycomb variant, this summer (2011). The Android Market for Google TV will come with this upgrade, making this a hot new Android platform that developers want to prepare for. There are several key differences between Google TV devices and traditional, portable Android devices, such as phones and tablets. Most of the tips involve accounting for these differences.

Preparing Your Application: Screen Density and Resolution

Google TV devices run at two resolutions. The first is 720p (aka "HD"), or 1280x720 pixels. The second is 1080p (aka "Full HD"), or 1920x1080 pixels. These may sound like large numbers, but let's see how they compare:

  • 1280x720 pixels is actually a lower resolution than existing Honeycomb (Android 3.0) tablets that run at 1280x800.
  • 1920x1080 is actually exactly 4x the number of pixels found on a phone with a qHD ("quarter" HD -- makes sense, right?) display, which is 960x540 pixels.

Android tablets are typically used in landscape mode, but can be rotated to a portrait mode. Android phones are generally just the opposite. Televisions, however, are fixed devices and are only landscape-oriented. Unlike tablets or phones, though, televisions are not within arm's reach. When taking into account their distance from the user and their resolution, Google has come up with a standard definition for the DPI they will be treated as. This is not the physical DPI of the TV screen, but rather an approximation of the perceived DPI of the screen because the user sits at some distance from the screen.

For the 720p screens, the DPI will be considered high, or HDPI. For the 1080p screens, the DPI will be considered extra high, or XHDPI. Both screens are considered to be large, as far as resources go.

When creating graphics and resources, these properties -- resolution, density, large size, and landscape orientation -- can be combined to narrowly target Google TV devices. Graphics and layouts should be fairly large. The perceived density is fairly realistic. A layout that may look right or slightly over-sized on a tablet might be just right for the TV.

One caveat is to not rely on the exact number of pixels. Televisions work a bit differently than regular screens and not all will actually expose every single pixel. Google TV will adjust the exact resolution so nothing gets cropped from the edges. This means your screen designs should be somewhat flexible to accommodate small adjustments when you've had a chance to test your applications on real Google TV devices.

Touching Televisions? Please Don’t

Beyond the physical differences between phones, tablets, and televisions, there is another important difference: televisions don't have touchscreens. A typical interface to a Google TV device is with a direction pad, or d-pad, -- that is, arrow keys for up, down, left, and right along with a select button. Some Google TVs may also have a mouse that is considered to be a "fake touch" input device. This has several implications in terms of input method assumptions when designing and publishing applications.

First, when designing applications for Google TV, keep in mind the navigational limitations of the d-pad: users can't easily skip over items, there's no diagonal equivalent, and it doesn't emulate multitouch navigational aids. For instance, if you interface currently has a row of items with the two most common on the far left and far right for convenient access with thumbs, these two items may be inconveniently separated for the average Google TV user. In other words, pay attention to control navigation order.

Second, without touch there is also no multitouch support. If your application requires multitouch gestures for navigation actions, functions, or other important components, it won't work with Google TV.

Third, the Android Market uses filters to prevent applications from showing up on certain devices based on explicit items in the manifest file. In addition, several items are implicitly defined. One of these is touch. If you don't have an entry for touch, the filter will assume that touch is required. When it does this, these applications will not show up on for Google TV. In order for your application to show up, you must set the required attribute of the <uses-feature> entry to false, like this:

This says that your application uses touch, but that it's not required. That is, your application will function correctly when not on a touch enabled device. You will need to provide smooth alternative functionality for this use-case.

No Native Development Kit, Yet

If your application relies upon the C/C++ libraries and the Android Native Development Kit (NDK), you’re going to run into trouble. For now, there is no NDK support for the Google TV. Keep asking for it, though, because it came up time and time again at Google IO as a developer request, and it’s developer requests that get new features on the roadmap for future releases.

Testing Your Application

As there is no emulator yet available with a true Google TV Android image, we can only test the effects of the higher screen resolution and using the application with a touch screen.

The easiest way to do this is to create a new AVD using Android 3.1, API Level 12, use a resolution of 1920x1080 (or 1280x720), and use a touch screen setting of false. The performance of the emulators may make this difficult, but at least you can get an idea of what the screen will look like and how the navigation or your application will function without touch.

Conclusion

The Android Market and the coming avalanche of applications for Google TV devices is still several months away. However, you can use this time to prepare your applications for these exciting new devices. Targeting Google TV devices is fairly straightforward: simply choose the right version of the Android SDK (Honeycomb) and consider your layouts, graphics and navigational elements carefully. Provide smooth alternative functionality for touchscreen and telephony features, which are unavailable on these devices. You will also be ready to make sure your application will appear in the market for Google TV devices as soon as they reach users’ hands.

About the Authors

Mobile developers Lauren Darcey and Shane Conder have coauthored several books on Android development: an in-depth programming book entitled Android Wireless Application Development and Sams Teach Yourself Android Application Development in 24 Hours. When not writing, they spend their time developing mobile software at their company and providing consulting services. They can be reached at via email to [email protected], via their blog at androidbook.blogspot.com, and on Twitter @androidwireless.

Need More Help Writing Android Apps? Check out our Latest Books and Resources!

Buy Android Wireless Application Development, 2nd Edition  Buy Sam's Teach Yourself Android Application Development in 24 Hours  Mamlambo code at Code Canyon

Tags:

Comments

Related Articles