This post was originally published at Tutorial: Creating Android TV Apps

Today’s guest tutorial comes to you courtesy of Greg Pugh, a Corona Ambassador, app developer, video tutorial instructor, children’s book author, and illustrator. Check out Greg’s site at for his tutorials and current games.

Corona Labs recently implemented support for the Android TV, a competitor to the Amazon Fire TV and Apple TV. Last year, Ed Maurina released a module that maps the controls to the Amazon Fire TV, so I’ve taken his code and modified it for the Android TV controller. I’m going to show you how you can implement the Android TV game controller button events into your game so you can upload it to the Google Play Store.

First, download the source folder from Dropbox. In this folder, you’ll see a file named RGEasyFTV.lua. This is Ed’s FireTV controller code that I’ve edited. If you open it, you’ll see the code numbers for the Android Game Controller.

Since these are mapped for you here, you’ll only need to reference the buttons by their names in your code (e.g. keyName == 'a').

In the build.settings file, you see that I’ve set supportsTV to be true and isGame to true. The supportsTV line is essential making your app compatible with the Android TV — without this line of code, your app can still be approved for Google Play, but it will not show up as compatible with the customer’s Android TV devices.

In Screen1.lua, you’ll see the following code:

This is the function I use to control the app using the Android TV game controller. You’ll notice that I give the option to either use either the directional pad or the A button. The great part about Ed’s RGEasyFTV.lua file is that it enables you to use your computer’s keyboard to test the app as you’re developing it. So, either the right arrow or the A key on your keyboard can be used until your install it on an actual Android TV.

Two additional pieces of artwork that you’ll need to include for an Android TV app are a 320×180 Banner-xhdpi.png file and a screenshot of how it will look on a TV screen that you’ll add to your app profile on Google Play.

Once your events are coded to game controller input, you can build the app for Google Play:


Next, using your developer cable, hook your Android TV to your computer via the USB port and make sure the device is hooked up to a TV and powered on. On my MacBook, I dragged the exported AndroidTVTutorial.apk file into android → sdk → platform-tools.


In the Terminal/console, I changed the directory to platform-tools, found my Android TV device, and installed AndroidTVTutorial.apk onto it:


Now the app is available to play on Android TV:


Once you’ve tested it, you can upload it to Google Play and, if you’ve done everything correctly, your app will now be Android TV compatible!


Visit site – 

This post was originally published at Tutorial: Creating Android TV Apps