Testing Android TV Apps
Testing Android TV Apps
Among all the hype with the latest improvements in Android as an OS and devices such as foldables and the new Pixel 3a, one device category goes unnoticed despite all its might, namely the Android TV. If you have an Android TV installed in your living room, you should know that it is a fully-featured Android device, no dumber than your smart phone or favorite tablet device. It can play videos, run 3D games, browse web/social networks and pretty much can do whatever you need.
Android TV Blog Post Series
These posts build on top of each other. If you plan to learn other cool stuff as well, feel free to take a look.
- Testing Android TV Apps
- Tracking Video Events in Android TV (with MediaPlayer)
- ExoPlayer Analytics for Android TV
A Very Big Phone
Yes, but without a touch screen, sometimes. In some cases though, it comes with a mouse-like pointer device controlled with hand motion or trackballs. If you are already confused, don’t worry. Here is a non-exhaustive but useful matrix chart of differences between Android phones and Android TVs for your convenience.
|Feature||Android Phone||Android TV|
|Mouse||No||50% chance Yes|
|D-Pad or Hardware Keyboard||No||Yes|
|Distance to user||~25cm||~3m|
|Always in landscape orientation||No||Yes|
|Display web content||Browser Apps or WebView||Only WebView|
|Video Playback outside of app||No||Yes via Now Playing Cards|
|4K Display||Very Unlikely||Very Likely|
|Common User Behavior||Scroll and Touch Buttons||Click buttons or Search|
|Popular Apps||Social Networks||Channels or Video Players|
|Internet Connection||Mostly 3G/4G||Home Router|
|Power Supply||Batteries||Power Cable|
|Google Play Approval||Easy||Very Hard|
Don’t be. If you really think about it, those points are not limitations but features. Google knows that you can carry your phone around with you and if you have a trivial issue with an app, you can simply ask a friend to help you. This is not the case with a 45″ TV. People expect to install a TV and see it act as robust as a good old CRT.
There is a thorough list of things to check before you release an app for Android TV buried deep in the official docs which you should definitely take a look.
At a quick glance, this chart tells us that in Android TV, visual quality is the number one concern you cannot be careless about.
What do I test?
You test every API endpoint and component related to your business logic, just like you would do in a mobile app. Additionally, you make sure all your layouts work with a D-Pad and every View and text is visible from far distance. In order to reduce the pain in your user acceptance tests, here is a cheat list you may follow, which will eliminate most of the visual issues. All the items below are testable by Espresso and the Android SDK via instrumentation tests.
- Prepare your manifest as described here. Failing to do so will cause automatic rejection by Google Play Store if you try to publish.
- Prefer sp as a unit of measure.
- No View or text should be smaller than 1.3cm in both width and height. This corresponds to 48sp in xhdpi.
- Avoid texts longer than a single sentence. In most cases, one title with a single subtitle or description line should be enough for your content.
- Apply at least 10sp padding to your outer most layouts to avoid drawing outside of TV frame. Some TVs crop the content near the edges.
android:nextFocusRightattributes for all your selectable views.
- Avoid placing views aligned diagonally to each other. It is confusing to navigate in such layouts with a D-Pad.
- If you are reusing code from a mobile version of the same app, make sure you are not forcing portrait mode in your manifest or activities.
- Utilize Leanback Support Library to provide a good search experience.
- Unlike mobile, default to highest definition for your videos. Most of the time, you won’t worry about saving data.
- Don’t depend on a menu button. Most remote controllers don’t have such buttons.
- Utilize Now Playing Cards and fill all the meta data appropriately.
- If not too much trouble, use ExoPlayer instead of native MediaPlayer APIs for an improved video playback experience. It is shipped with great extensibility features you and your users will love.
- Test your apps in at least 4 different display sizes, namely 720p, 1080p, 1440p and 2160p (4K).
- Use at least a bitrate of 10mbps for your encoded videos to avoid visual artifacts.
We’d love to hear your experiences!
The list above is not the whole picture at all. If you think we made a mistake or you can suggest additional items to be added there, please let us know. It is in our best interest as industry to provide the best TV experience possible inside living and meeting rooms. Cheers!