Grato por sua visita. Neste momento esta página está apenas disponível em inglês.

Creating a Media Streaming App

Last updated June 2016.

Creating a Media Streaming App

When it comes to media streaming 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 media streaming 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 0: 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.

Enable ADB connections over the network.

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.

Turn on ADB debugging.

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.

Enter your IP address of your Fire TV.

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

Where needs to be substituted with the Fire TV IP address you copied previously. Now, you are connected to the Amazon Fire TV and can deploy your first media streaming app.

Step 1: Create the Project Through Android Studio Project Wizard

First, create a new Android project through the Android Studio Project Wizard.

Create a new Android project through 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.

Select 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 2: 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 media streaming 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:

Your Fire TV app interface will look like this.

You will be able to navigate the content and the categories, see details of the content and launch media streaming. The application already contains a lot of additional features like animations, fragment support, and memory optimizations for loading media streaming content. This could be an easy boilerplate for creating a much more complex and rich Fire TV app.