Mokrab
Mokrab

Reputation: 55

AndroidTV TvInputService Implementation

I am having problems with implementing TvInputService.

I have all information from the server concerning channels(end/start times, Uri addresses, id, name, etc..)

My objective is to create an app to setup streaming channels from this information gotten from the server. I tried this http://developer.android.com/training/tv/tif/tvinput.html ... even thou I understand the theory (mostly), I am still new to this and because the website does not provide coding examples and thorough explanation of it, it is really frustrating. I also tried the Sample provided by android, but that is too complex for what I am trying to do, and it just confuses me even more.

Can someone help me out by explaining(simple way, if possible) with some examples all about TvInputService implementation? Thank you!

Upvotes: 3

Views: 3065

Answers (3)

Mokrab
Mokrab

Reputation: 55

I am getting "Unable to start auto-scan for 'Authorization' " after I try to install the channels. I am using files from ChannelSurfer, managed to make the provider and HOPEFULY the setup(still confused about it), but I'm stuck on this part... The console does not throw a single error but the TV says the above statement. Why does this happen and what are the possible fixes?

Upvotes: 0

Nick Felker
Nick Felker

Reputation: 11978

You may want to use my library, ChannelSurfer, which greatly simplifies the development of TV input services.

There are a few main steps that you need to do to create an input service.

  1. Declare what channels are accessible.
  2. Declare what programs will be played on each channel
  3. When a user tunes to your channel, how will the video be displayed

This is done normally through SyncAdapters and services, although this library boils everything down to a single class that you create based on your own specifications.

There's an example app as well if you need more help.

Upvotes: 1

abielita
abielita

Reputation: 13494

Based from this documentation, those implementing TV input services should normally do so by deriving from this class and providing their own session implementation based on TvInputService.Session.

Your app manifest must declare your TvInputService then specify the BIND_TV_INPUT permission to allow the service to connect the TV input to the system.

<service android:name="com.example.sampletvinput.SampleTvInput"
    android:label="@string/sample_tv_input_label"
    android:permission="android.permission.BIND_TV_INPUT">
    <intent-filter>
        <action android:name="android.media.tv.TvInputService" />
    </intent-filter>
    <meta-data android:name="android.media.tv.input"
      android:resource="@xml/sample_tv_input" />
</service>

You can check this example on GitHub.

Upvotes: 1

Related Questions