Android TV questions

If I understood it right, we have two options when porting an existing game to Android TV:

  1. create a new version for TV (new APK, new game in Google Play dashboard)

  2. expand the existing version to support Android TV

The first option is easier to implement but the second would be better, I guess.

Now, if we go with the second option there are several challenges because we have to change the game a bit depending if it is running on mobile or TV (e.g. game controller support, exclude some missing features - e.g. facebook, change menu behaviur etc.)

The first step would obviously be to determine if the game is running on the TV.

How can we do it in Corona?

Here is what Android documentation recommends:

Check for a TV Device

If you are building an app that operates both on TV devices and other devices, you may need to check what kind of device your app is running on and adjust the operation of your app. For instance, if you have an app that can be started through an Intent, your application should check the device properties to determine if it should start a TV-oriented activity or a phone activity.

The recommended way to determine if your app is running on a TV device is to use theUiModeManager.getCurrentModeType() method to check if the device is running in television mode. The following example code shows you how to check if your app is running on a TV device:

public static final String TAG = “DeviceTypeRuntimeCheck”;

UiModeManager uiModeManager = (UiModeManager) getSystemService(UI_MODE_SERVICE);
if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) {
    Log.d(TAG, “Running on a TV Device”)
} else {
    Log.d(TAG, “Running on a non-TV Device”)
}

Second question is: Are ads supported on TV?

I believe from our perspective there is little difference between an Android Device and an Android TV.  You simply include the various controller event support (buttons and axes), have it be landscape and make sure anything that would be touch can be done with a controller and you should be good to go.

Ads should work, but I don’t know if its been tested.

Rob

Its a big difference if it is on a TV.

The design for TV should be at least a bit different because you do not have the touch and have to handle all the input via controller or dpad.

So it is essential to know if the game is played on TV or phone/tablet.

1 Like

Have you gone through the new Corona Canon project?  This handles both TV and mobile with one code base

No, will take a look and let you know if we have more questions.

Working on the project to port one of our game to ALL platforms supported by Corona.

So far we are on Android, iOS, BlackBerry, OS X.

To go: Android and Amazon TV, Apple TV, Windows Phone

OK, browsed through the example but did not found any code which determines if the game is on TV (guess it is designed so it does not care).

But I am sure there are cases when you would like to know if you are on a TV.

Found this possible workaround posted by Joshua.

Maybe he can comment a bit more about this. Thank you!

https://forums.coronalabs.com/topic/56373-is-there-a-model-parameter-for-systemgetinfo-that-covers-all-android-tv-devices/

That was kind of my point. If your app is designed to work on 16:9 landscape screens and it both responds touch and controller inputs, the rest of it doesn’t matter. You don’t need to know if you’re on a TV to only setup controller events. Android devices can use controllers too, so it’s beneficial to support controllers there.

Rob

I think it is important to check for a Fire TV device, because you need to give on screen instructions for the controller. For example on the TV version you might want to display the Fire TV remote and explain which key does what. On Smart Phone device you would not.

Right know the command

system.getInfo( "model" )

returns “AFTM” as a result on Amazon Fire TV. An update of the docs would be good.

Hope this helps.

René

I’ve requested this be added.

Rob

Thank you, Rob!

I believe from our perspective there is little difference between an Android Device and an Android TV.  You simply include the various controller event support (buttons and axes), have it be landscape and make sure anything that would be touch can be done with a controller and you should be good to go.

Ads should work, but I don’t know if its been tested.

Rob

Its a big difference if it is on a TV.

The design for TV should be at least a bit different because you do not have the touch and have to handle all the input via controller or dpad.

So it is essential to know if the game is played on TV or phone/tablet.

Have you gone through the new Corona Canon project?  This handles both TV and mobile with one code base

No, will take a look and let you know if we have more questions.

Working on the project to port one of our game to ALL platforms supported by Corona.

So far we are on Android, iOS, BlackBerry, OS X.

To go: Android and Amazon TV, Apple TV, Windows Phone

OK, browsed through the example but did not found any code which determines if the game is on TV (guess it is designed so it does not care).

But I am sure there are cases when you would like to know if you are on a TV.

Found this possible workaround posted by Joshua.

Maybe he can comment a bit more about this. Thank you!

https://forums.coronalabs.com/topic/56373-is-there-a-model-parameter-for-systemgetinfo-that-covers-all-android-tv-devices/

That was kind of my point. If your app is designed to work on 16:9 landscape screens and it both responds touch and controller inputs, the rest of it doesn’t matter. You don’t need to know if you’re on a TV to only setup controller events. Android devices can use controllers too, so it’s beneficial to support controllers there.

Rob

I think it is important to check for a Fire TV device, because you need to give on screen instructions for the controller. For example on the TV version you might want to display the Fire TV remote and explain which key does what. On Smart Phone device you would not.

Right know the command

system.getInfo( "model" )

returns “AFTM” as a result on Amazon Fire TV. An update of the docs would be good.

Hope this helps.

René

I’ve requested this be added.

Rob

Thank you, Rob!