TvInputService, which represents your streaming media source. With TV input service, you can provide parental controls, program guide information, and content ratings. Keep in mind that you must implement all code on this page before your app can compile and install correctly.
Create minimal TvInputService
Create an Android Service class that extendsTvInputService.
The following is an example of a minimal implementation of TvInputService.
- Java
- Kotlin
Define input service’s resource XML file
Each input service must have a resource XML file which defines common input attributes. Here’s an example of such a file, located in res/xml/richtvinputservice.xml:
Important Details
Declare your TV input service in the manifest
The following is an example ofTvInputService in the application section of AndroidManifest.xml.
Important details
| Activity | Required? | Input | Notes |
|---|---|---|---|
android:label | Yes | ”My Input Name” | Put your own service name here |
android:permission | Yes | ”android.permission.BIND_TV_INPUT” | This gives Android permission to allow the service to connect the TV input to the system. |
| <intent-filter> | Yes | <action> | A filter used by the system to launch the service. |
android:name | Yes | ”android.media.tv.input” | It must be the correct name for Android to recognize the service correctly. The resource must point to the following structured XML file. |
Define SetupActivity
To add logic to the app, you must add aSetupActivity class (you can choose the name of this class). The following is an example of a SetupActivity class to invoke the activity.
- Java
- Kotlin
SetupActivity as a class and add the activity in the Android manifest XML file, as shown in the following code.
Checkpoint: Your input name appears under sync sources
Use the following steps to verify your setup.-
Build and install your APK on a Fire TV.
- Connect to Fire TV through ADB.
- Install and run your app.
- Alternatively, you can use Android Studio to install and run your app.
- Navigate to Settings > Live TV > Sync Sources.
- Your input name should appear under the menu.
- Click on your name in the menu.
SetupActivity should launch.
If running and installing from Android Studio, an option for Fire TV should appear in the devices section.
Troubleshooting
This section contains steps to troubleshoot issues you might encounter. The application is not showing up in sync sources. Use the following command to get the device log.- Mac or Linux
- Windows
TvInputService has not been correctly defined.
To resolve this, verify the following:
- Has the Fire TV device been updated to the latest software?
- Go to Settings > My Fire TV > About > Check for Updates. Select this option and update if needed.
- Does the InputService have correct permissions?
- Does the InputService have the correct intent-filter?
- Does the InputService have the correct meta-data defined?
- Does the InputService’s meta-data link to the correct XML resource?
- Does the XML resource have the
SetupActivitydefined? Is theSetupActivityvalid?
ProviderRegistry.
- Mac or Linux
- Windows

