Step 1: Create a Streaming Media App
The Android Leanback Support Library contains all the main components and widgets to create an efficient and attractive streaming media Android app. Android Studio provides an easy way to deploy a Leanback-enabled Android TV sample project.
- Streaming Video Content
- Next Steps
Streaming Video Content
When it comes to streaming media devices like Fire TV, one of the most common use case is to stream video content, like movies, TV series, or video-sharing channels like YouTube. The Android Leanback Support Library contains all the main components and widgets to create an efficient and attractive streaming media Android app. Android Studio provides an easy way to deploy a Leanback-enabled Android TV sample project. The great news is that this sample project works out of the box on Fire TV.
Step 1: Enable Developer Options and ADB Over WiFi on Fire TV
Before creating your project and deploying to the Amazon Fire TV, you need to enable Developer Options and Debug adb on your Fire TV. To do this, navigate to the Settings of the Fire TV and go to System > Developer Options.
Next, enable Developer Options and ADB. The best way to develop on Amazon Fire TV is to connect via WiFi to the device. This way, you can even sit down on a couch and develop in front of our TV to experience your TV app like your users will. To enable ADB, just set ADB Debugging to On.
At this point, your Amazon Fire TV is ready to receive Android debug apps. The last thing you need is the IP address of your Fire TV to be able to connect your development environment to the Fire TV over the network. To retrieve it, go to Settings > System > About > Network, and copy the IP Address.
On a computer connected to the same WiFi network as the Amazon Fire TV, you can now open up your terminal and run the following command:
adb connect <ip-address>:<port>
<ip-address>:<port> needs to be substituted with the Fire TV IP address you copied previously and the port (use
5555 for the port). Now, you are connected to the Amazon Fire TV and can deploy your first streaming media app.
Step 2: Create the Project Through Android Studio Project Wizard
First, create a new Android project through the Android Studio Project Wizard.
Select TV as the form factor for your app and set Minimum SDK to API 21: Android 5.0 Lollipop. Click the Next buton and click to add an Android TV Activity.
You can then follow the steps to finalize your TV project. When you click Finish, Android Studio will generate a project containing a Leanback-enabled TV app.
Step 3: Run Your First Amazon Fire TV App
You can now run your first Amazon Fire TV app. The app that was created by the Android Studio Wizard contains all the main components of a complete streaming media app. Just click the Run button on Android Studio and if you are connected to your Fire TV, the app will appear on the screen. The interface will look very similar to this one:
You will be able to navigate the content and the categories, see details of the content and launch streaming media. The application already contains a lot of additional features like animations, fragment support, and memory optimizations for loading streaming media content. This could be an easy boilerplate for creating a much more complex and rich Fire TV app.
Continue on to the next step in this tutorial: Step 2: Understand the Anatomy of a Leanback-Enabled Android App for Amazon Fire TV.