Adding TV Channels to Your App with the TIF Companion Library


Posted by Nick Felker and href="http://google.com/+SachitMishraDeveloper">Sachit Mishra, Developer
Programs Engineers



The TV
Input Framework (TIF)
on Android TV makes it easy for third-party app
developers to create their own TV channels with any type of linear media. It
introduces a new way for apps to engage with users with a high-quality channel
surfing experience, and it gives users a single interface to browse and watch
all of their channels.



To help developers get started with building TV channels, we have created the href="http://github.com/googlesamples/androidtv-sample-inputs">TV Input
Framework Companion Library, which includes a number of helper methods and
classes to make the development process as easy as possible.



This library provides standard classes to set up a background task that updates
the program guide and an interface that helps integrate your media player with
the playback controller, as well as supports the new TV Recording APIs that are
available in Android Nougat. It includes everything you need to start showing
your content on your Android TV's live TV app.




(Note: href="https://github.com/googlesamples/androidtv-sample-inputs">source from
href="https://github.com/googlesamples/androidtv-sample-inputs">android-tv-sample-inputs
sample)



To get started, take a look at the href="https://github.com/googlesamples/androidtv-sample-inputs">sample app
and href="https://developer.android.com/training/tv/tif/index.html?utm_campaign=android tv_discussion_tif_110916&utm_source=anddev&utm_medium=blog">documentation.
The sample demonstrates how to extend this library to create custom channels and
manage video playback. Developers can immediately get started with the sample
app by updating the href="https://github.com/googlesamples/androidtv-sample-inputs/blob/master/app/src/main/res/raw/rich_tv_input_xmltv_feed.xml">XMLTV
file with their own content or dynamically creating channels in the href="https://github.com/googlesamples/androidtv-sample-inputs/blob/master/app/src/main/java/com/example/android/sampletvinput/SampleJobService.java">SampleJobService.



You can include this library in your app by copying the library
directory from the sample into your project root directory. Then, add the
following to your project's settings.gradle file:


include ':library'


In your app's build.gradle file, add the following to your
dependencies:


compile project(':library')


Android TV continues to grow, and whether your app has on-demand or live media,
TIF is a great way to keep users engaged with your content. One partner for
example, Haystack TV, recently integrated TIF into their app and it now accounts
for 16% of watch time for new users on Android TV.



Check out our TV developer
site
to learn more about Android TV, and join our developer community on
Google+ at g.co/androidtvdev to discuss
this library and other topics with TV developers.