This article details the steps you should follow when building and submitting an Android TV application using Zype's template. Steps 1-14 can be followed when building an Amazon Fire TV application, whereas Steps 15 and beyond relate specifically to building an Android TV application.
Table of Contents
Building the AFTV / Android TV App from the Template
1. Create a folder for a project.
2. Clone the https://github.com/zype/zype-firebuilder repo.
Warning! Do not open the project on this prompt. Select “Cancel” for now:
3. Open Application folder inside your project path as an existing Android Studio project:
4. Make sure that “templateDebug” build variant is selected for the “app” module:
5. Update app settings in the Application/ZypeAPI/src/main/java/com/zype/fire/api/ZypeSettings.java file.
The following values are required:
// Zype app key
public static final String APP_KEY = "";
// OAuth credentials
public static final String CLIENT_ID = "";
public static final String ROOT_PLAYLIST_ID = "";
You can get these values from your Zype account.
Note! Do not change the following values:
public static final String FAVORITES_PLAYLIST_ID = "Favorites";
public static final String MY_LIBRARY_PLAYLIST_ID = "MyLibrary";
public static final String ROOT_FAVORITES_PLAYLIST_ID = "RootFavorites";
public static final String ROOT_MY_LIBRARY_PLAYLIST_ID = "RootMyLibrary";
public static final String ROOT_SLIDERS_PLAYLIST_ID = "RootSliders";
public static final String TEMPLATE_VERSION = "1.8.0";
6. Update application id in the Application/app/build.gradle file.
This value identifies your app on the device and in the marketplace. This must be unique and usually is following com.yourdomain.aftv pattern.
7. Set the application name.
Set the app name in the Application/app/src/template/res/values/strings.xml file:
Also this value need to be set in the following files:
Set the short app name in the Application/app/src/template/res/values/strings.xml file:
<string translatable="false" name="app_name_short"><APP_NAME_SHORT></string>
8. Set your brand color.
Set your brand color in the Application/app/src/template/res/values/custom.xml file:
9. Add your company logo image.
Add the following image file Application/app/src/template/res/drawable/logo_company.png.
This image is displayed on the splash screen and on the content browse screen in the top left corner.
The image dimensions should be approximately 356x108 px and have a transparent background.
10. Add your application icon.
Add a set of icon image files in required dimensions:
You can use the icon generator in Android Studio to produce icons with required dimensions from 512x512 px source icon image.
11. Confirm the theme is set correctly (dark or light).
The app uses a dark theme by default with black / dark grey screen background and white text color.
To set the light appearance, set the following feature flag in the Application/ZypeAPI/src/main/java/com/zype/fire/api/ZypeSettings.java file:
public static final boolean LIGHT_THEME = true;
Also update the following values in the Application/app/src/template/res/values/custom.xml file:
<!-- The background color of the screens. -->
<!-- Used for card background -->
<!-- Color of splash screen spinning loader animation -->
<!-- Used for the text of a selected item's title and description.
Also used for button text, Splash screen text, and read more dialog text. -->
<!-- Used for the text on the card views and playback progress bar text. -->
<!-- Used for the category titles and content subtitles -->
Packaging the App
12. Generate an APK file:
13. Sign the APK.
Use your existing key to sign the app or create a new one, if you are creating the app for the first time:
Note! Keep the keystore file and its passwords in the safe place. To be able to update the app in the store in future, you must use the same key to sign the app that was used for signing the initially published APK.
14. Finish building the APK.
Choose templateRelease build variant when building the APK to be published in the app store.
Additional Configuration Steps Required for Android TV
To be able to submit the app for Android TV platform in Google Play Store you should make the following changes in the source code:
15. Google Play in-app purchasing is currently not supported in the template, so the following monetization options, that depend on in-app purchases, should be turned off:
public static final boolean MARKETPLACE_CONNECT_SVOD = false;
public static final boolean NATIVE_SUBSCRIPTION_ENABLED = false;
public static final boolean NATIVE_TVOD = false;
16. In the\Application\app\build.gradle file make sure that targetSdkVersion value is set to 29.
17. Add an application banner image.
Switch project view from ‘Android’ to ‘Project’ in Android Studio:
Find \Application\app\src\template\res in the project tree:
If you don’t have a drawable-xhdpi folder inside the \res, you need to create it.
Right click on the \res folder and select ‘New’ -> ‘Directory’ in the context menu:
In the ‘New Directory’ dialog enter ‘drawable-xhdpi’ name and click ‘OK’:
The \app\src\template\res\drawable-xhdpi folder will appear in the project tree:
Copy your banner.png image file into this folder.
This image appears on the TV’s home screen in the apps and games rows. The image size must be 320x180 px.
You can check out this guide for more information on banner image: https://developer.android.com/training/tv/start/start#banner
Submitting to Google Play Store
To publish an Android TV app to Google Play Store you follow the typical process of publishing Android apps.
Additionally, you have to upload images specific to Android TV to the “Graphic assets” section:
1. Add a minimum of 2 screenshots in the “ANDROID TV“ tab of “Screenshots” section:
2. Add a “TV Banner” 1280x720 px image:
It is used as the app’s icon on the TV device:
3. You are now ready for submission!