Why should you release your game for TVs?

Besides the fact that seeing your game on a big screen is just really cool, releasing for the TV has another big advantage for us indies: The Amazon App Store and Play Store for TVs are not as crowded as the ones for normal devices, so you get a better visibility when you release for TVs. I experienced that games that can be controlled with just the remote control have a very big audience on Amazon. And: It is really easy to adjust a libGDX game for Android TV and FireTV.

Test it on the real thing!

Because FireTV sticks are very cheap, testing on a real device is no problem. You can buy a FireTV stick for under 40$ (or 35€). Android TVs are more expensive, but there is an emulator image provided in Android Studio. If you have a FireTV stick and test on it, you will hardly need an Android TV test device.

This sounds cool. Are there really no drawbacks?

Yes, there is a drawback: Advertisements are hard to place. Amazon Ad Network does not show ads on the FireTV. AdMob does show it on Android TV, but they are not adjusted to the TV and it is not clear if it is allowed to show them. That’s probably the reason why there are hardly any free games available for the TVs.

And, of course, another drawback is the limitation of input buttons. Of course, both FireTV and Android TV can connect any Bluetooth Game Controller. But as I wrote before, I recommend you to reduce to the remote control input. (But also support game controllers!)

So on what input buttons can you rely?

Here is a picture of a Nexus Player Remote Control:

Nexus Player Remote Control

You see, when aiming for Android TV, you can just rely on a D-Pad, Center and Back buttons. Fire TV has some more:

FireTV Remote Control

If you aim for FireTV, you know for sure you can additionaly use Play, Fast Forward, Rewind and Menu buttons.

All in all, that’s not too bad: These are enough buttons for Flappy Birds, Badlands, DATA WING, Asteroids, Tetris, Pacman, Candy Crush...

Nice! Now, what is to do to get my game to work with the TV Remote?

This is more easy than you think at first. Indeed, the TV remote’s D-Pad gives you the very same key codes in your libGDX listeners as your hardware keyboard on your desktop: Input.Keys.DOWN, Input.Keys.UP and so on. Just the Center Button gives another keycode than your desktop’s Enter key. It is, not surprising, Input.Keys.CENTER. The back key gives you Input.Keys.BACK, which you should already listen to because this keycode is also used on every smartphone.

While it is easy to get the button input done for the gameplay, trying to build button-controllable menus with libGDX’ great Scene2d.ui unfortunately is not. That’s why I open-sourced my approach: the Button operable Scene2d comes with an extended Stage that knows about focusable actors and some predefined UI actors that support button and key control.

The following video shows it in action in my game:

Or try the game in your browser or on your TV.

Is there more needed for releasing on the big screen?

No — indeed, it is basically just making your game ready for button input and landscape mode. After you’ve done that, add the following line to your AndroidManifest.xml to indicate that your game does not need a touchscreen:

<uses-feature

android:name="android.hardware.touchscreen"

android:required="false"/>

You will be able to sideload, run and play your game on FireTV stick and AndroidTV with these customizations.

Perhaps your game needs to know if it runs on a TV or on a normal Android device. Checking this is possible in libGDX core by checking if you are on an Android device without touch. This way, you catch both FireTV and AndroidTV devices: