Boring! Again there is nothing to see on the TV! At least not something that seems to be interesting enough. Smart TVs running on Android create a whole new interesting world for developers. Finally, we get the screen size we deserve!
However, it also comes with a different type of audience. Users interact with their phones and tablets to a very large extent. When it comes to watching TV, the focus is much more on consuming.
Well, what is there on the TV? Have a cup of tea and start watching the show. Occasionally, users might be interested in some interaction (a phenomenon that mostly appears as a second screen app since not anyone does own a smart TV already), but most of the time, TV watchers just want to lean back.
This recipe requires Android Studio up and running and the latest SDKs installed. In this recipe, we will provide you a brief introduction to a TV app. In only a few steps, we will create a media centre app. Don't worry, you do not need to have an Android TV. We will create a virtual one.
Let's see what we need to do to develop an Android TV app:
PersonalTeeVee
and click on the Next button.TeeVeeActivity
in the Activity Name field and Personal Tee Vee
in the Title field and click on the Finish button.AndroidManifest.xml
file in the tv module. Note the lean back feature requirement (which tells us that this is a TV app with fullscreen experience without any heavy interaction and basically is about consuming content such as watching a video). Also note that we do not require a touch screen. The TV screen is too far away to touch. Besides, nobody likes smears on their TV screens:<uses-feature android:name="android.hardware.touchscreen" android:required="false" /> <uses-feature android:name="android.software.leanback" android:required="true" />
Wow, this is a fully functional media centre app already!
This was just a brief introduction to building an Android TV app. Play with it and tweak it.
While the app in this recipe is dedicated to a TV, I see no reason why you couldn't make it an app for any kind of device: phone, phablet, and TV. If you want, you can combine all the recipes in this chapter into a single app. That's a nice challenge, isn't it?
Besides YouTube, there are also interesting media-related APIs to investigate. On www.programmableweb.com, for example, you can find some interesting APIs. Some of them are listed here:
API |
Navigation |
---|---|
YouTube |
http://www.programmableweb.com/api/youtube-live-streaming |
Vimeo |
http://www.programmableweb.com/api/vimeo |
Hey! Spread |
http://www.programmableweb.com/api/heyspread |
Pirateplay |
http://www.programmableweb.com/api/pirateplay |
Tinysong |
http://www.programmableweb.com/api/tinysong |
TwitVid |
http://www.programmableweb.com/api/twitvid |
Well, now we know where to get media items from, how to play them, and how to automagically create a media centre app.
Coming up next: let's create some media ourselves by capturing some images. See you at the next chapter!