Enhancing The Experience With Android TV: Briefly About One Developer's Impressions

  •        0
  

We aggregate and tag open source projects. We have collections of more than one million projects. Check out the projects section.



In my software development career, I have always been attracted to new technologies and innovative solutions. Project by project, I have been exploring something new, discovering and implementing different approaches and trying new solutions. When Android TV showed up, I set a new personal goal.

I described my impressions and the overall opinion on the application development for Android TV right here. Hope you will find it useful and interesting. 

Android TV: What Is New?

For those who have been sleeping in a cave, I have written a few words concerning Android TV basics. Android TV was announced at one of the greatest events in the IT world. Google I/O 2014 offered us a glimpse at it, and later, in the autumn of 2014, a hardware device that supports the technology was released.

Android TV is a type of Android OS created for digital media players, TV and set-top boxes.

In a nutshell, Android TV has brought the entertainment from a smartphone to a TV. Let’s take a look at the main features of this technology:

  • Android TV Is Easy To Use

If you do not agree with this statement, just go to Youtube or The Walking Dead channels and devote some time to the tutorials. When you turn the device on, you get the opportunity to use a convenient navigation that leads you directly to what you need.

  • Search Features Are Amazing

Hardware for Android TV recognizes the human voice. This makes searching a lot easier. With the help of this feature, you can start a video within seconds or perform more complicated actions like getting the list of 2018 Oscar nominations.

  • Google Assistant

Yes, you can have your reliable assistant on a TV, too! Since January 2017, Google Assistant is available on Android TV.

  • High-Quality Content

With Android TV, you have access to such apps as Netflix, BBC iPlayer and many others. Additionally, the technology is supported by the manufacturers’ apps. For example, if you use Sony TV, you can get the access to Sony Select. Google Play Store is at your disposal, too.

  • Google Play Games

Besides the applications, Android TV supports various games. You can play both online and offline, choose single-player or multiplayer games, save your progress and enjoy playing on a big screen.

This is not a full list of features available on Android TV. Additionally, you can use various settings to customize the technology on your device, send media from your smartphone to your TV and try other useful features.

Android TV Application Development Experience: My Impressions

I could not resist the temptation to take part in a test project when such an opportunity appeared.

To setup Android TV support to your project, you need to modify the AndroidManifest.xml file. Add the following lines of code:

<uses-feature

  android:name="android.hardware.touchscreen"

  android:required="false" />

<uses-feature

  android:name="android.software.leanback"

  android:required="true" />

Additionally, declare an appropriate IntentFilter for activity:

<intent-filter>

     <action android:name="android.intent.action.MAIN" />

     <category android:name="android.intent.category.LEANBACK_LAUNCHER" />

   </intent-filter>

This is how we can declare that the project does not support touch-screen controls and is able to interact with the Leanback interface elements.

Leanback Interface Specifics

Leanback library was created to simplify the process of integrating the technology. It differs from the usual Android apps interface.

The fact that the Leanback library UI elements were designed and built for devices without any touch-screen controls led to certain consequences. View has got an important intermediate state - selected. Usually, this state is not a big deal when used on Android apps. The Selected state informs the users which element they are interacting at the moment. It can be either a button or a list element.

Leanback Library offers various ready-made instruments. Here is the list of the most significant ones:

  • BrowseFragment,
  • RowFragment,
  • DetailsFragment,
  • VerticalGridFragment,
  • SearchFragment, etc.

The Leanback library provides the opportunity to display different data collections in the form of lists or tables. I have some RecyclerView development experience for standard Android apps in the past. So, it was rather interesting to see how Android TV implements the same functionality.

Presenter is an Android TV analog for RecyclerView.Adapter. Presenter can interact with ArrayObjectAdapter to display data in the form of tables.

Classes Hierarchy with BrowseFragment

In our project, we needed to display double-nested objects. At the same time, it was necessary to take care of optimized navigation for the user. BrowseFragment solved this task perfectly.

<

This Leanback library component displays the list of the objects on the left and the internal data of those objects in the table rows on the right. Below you can see what the hierarchy of classes for displaying data looks like:

ArrayObjectAdapter -> ArrayObjectAdapter -> Presenter

Let me explain this line. Presenter is responsible for displaying the ImageCardView objects. ImageCardView includes the image, title and subtitle. ArrayObjectAdapter is responsible for every row of the table. It manipulates the data and binds it to View-elements with the help of Presenter. ArrayObjectAdapter is also responsible for displaying the rows vertically. ListRowPresenter places the elements where they should be.

HLS-Link Video Streaming with ExoPlayer

Displaying a great volume of content was really fascinating. However, there was another challenging task when we were developing this project - video streaming via the HLS-link. So, let’s clarify the basics first.

HLS, or HTTP Live Streaming, is a communication protocol for streaming media. As you already know, it is based on HTTP. The protocol was developed by Apple and initially was included in Safari, QuickTime, OS X, iOS etc. The protocol is based on dividing the whole stream into smaller fragments which can be downloaded consistently via HTTP. The flow is continuous. Theoretically, it can even be never-ending.

After a comprehensive research, I have come to a conclusion that ExoPlayer is a nice choice for video streaming. The player has a convenient extension for Android TV. What to do to connect it? Just add the following lines to build.gradle:

api "com.google.android.exoplayer:extension-leanback:$versions.exoplaye"
api "com.google.android.exoplayer:exoplayer:$versions.exoplayer"

I wrote some simple code to enable ExoPlayer to open and play an HLS-link.

private void prepareMediaForPlaying(String hls) {

      DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(getActivity(),

           Util.getUserAgent(getActivity(), getString(R.string.app_name)));

      HlsMediaSource videoSource = new HlsMediaSource.Factory(dataSourceFactory)

              .createMediaSource(Uri.parse(hls));

      player.prepare(videoSource);

  }

A Few Words for the Beginners

Participation in this project was impressive and impactful. The point is, I created a brand new solution using the knowledge I already had. And it was great!

Now, I can say that every Android developer can easily deal with Android TV.

And last but not least, I would recommend you to get familiar with the following things before you start diving into Android TV development depths:

  • Android TV Official Documentation

You are literally helpless without reading the official documentation. So, devote some time to it to make your development experience pleasant.

  • Keep Your Hand On The Pulse

Google pays a lot of attention to Android TV development and improvement. So, check the official page to find out about the updates, news and essentials regarding how to use it.

  • Visit Github

Android Leanback and Leanback Showcase are sample projects uploaded to Github. Visit the pages and make sure by yourself!

Conclusion

My experience with Android TV was seamless and precious, so I wish the same to you! You can check our Android TV project and get the inspiration to expand your knowledge.

 

Reference:

https://developer.android.com/tv

https://developer.android.com/guide/topics/media/exoplayer

https://github.com/googlesamples/androidtv-Leanback


   

Vladyslav Pshenychka is a brand strategist, digital marketing expert, and a blogger. He is a passionate digital strategist. Currently, associated with Artjoker - a leading web development company in Los Angeles




Related Articles

LogicalDOC - Open Source DMS

  • dms document-management-system

LogicalDOC is both a document management and a collaboration system. The software is loaded with many functions and allows organizing, indexing, retrieving, controlling and distributing important business documents securely and safely for any organization and individual.

Read More


New Open Source Web Browser Engine from Google and Mozilla

  • browser browser-engine

Web Browser engine used to render the page from HTML, CSS and Javascript. The browsers are one of the most important tool to view the web and it is must have software in Desktop and Mobile. These new browsers will take advantage of tomorrow’s faster, multi-core, heterogeneous computing desktop and mobile architectures.

Read More


10 sites to get the large data set or data corpus for free

  • search test-data large-data-set data-corpus dataset

You may require GBs of data to do performance or load testing. How your app behaves when there is loads of data. You need to know the capacity of your application. This is the frequently asked question from the sales team "The customer is having 100GB of data and he wants to know whether our product will handle this? If so how much RAM / Disk storage required?". This article has pointers to the large data corpus.

Read More


Microsoft acquires GitHub. Is it Good or Bad?

  • microsoft github news

Microsoft announced that it is acquiring GitHub for 7.5 Billion dollars. GitHub is a most used Software developer and Code hosting platform. It hosts more than 80 million code repository and more than 20 million developers collaborate in GitHub. In addition to managing code repositories, GitHub has developed many tools to increase the productivity of developers. Almost 70% of open source projects hosted in GitHub. Microsoft is a big corporate leader and it buying a open source code hosting company, Is it good or bad?

Read More


Microweber CMS - An open source CMS with Ecommerce support

  • cms e-commerce microweber

To the user's satisfaction, there is a whole wide world of different CMS, all suitable for different needs. You can go for the giants like Wordpress or Joomla or pick one of the rising forces - Shopify, Squarespace or others. Microweber CMS fills a hole in the current technological ecosystem, aimed at delivering a light software that is perfect for all end-users lacking the technical knowledge needed for complicated website building.

Read More



Top 15 Open source alternative to Microsoft products

  • microsoft-alternative open-source-enterprise

Microsoft is monopoly in the commercial software. Here are 15 best alternatives to most popular and widely used Microsoft products.

Read More


AbanteCart - Easy to use open source e-commerce platform, helps selling online

  • e-commerce ecommerce cart

AbanteCart is a free, open source shopping cart that was built by developers with a passion for free and accessible software. Founded in 2010 (launched in 2011), the platform is coded in PHP and supports MySQL. AbanteCart’s easy to use admin and basic layout management tool make this open source solution both easy to use and customizable, depending on the skills of the user. AbanteCart is very user-friendly, it is entirely possible for a user with little to no coding experience to set up and use this cart. If the user would be limited to the themes and features available in base AbanteCart, there is a marketplace where third-party extensions or plugins come to the rescue.

Read More


SeoToaster: easy, fast and efficient open source CMS for top SEO performance

  • cms content-management-system seo ecommerce

SeoToaster is a free Open Source CMS & Ecommerce solution to build, manage and market websites optimized for for top search engine performance. As the name implies, Seo Toaster is to date the only content management system (CMS) to truly integrate SEO execution and web marketing automation technology in full compliance with the search engines industry’s best practices.

Read More


ONLYOFFICE Document Server, an online office app for Nextcloud and ownCloud

  • office office-suite word spreadsheet

ONLYOFFICE Document Server is a free collaborative online office suite including viewers and editors for texts, spreadsheets and presentations, fully compatible with Office Open XML formats (.docx, .xlsx, .pptx). This article provides you the overview of ONLYOFFICE Document Server, its features, installation and integration with Nextcloud and ownCloud.

Read More


An Introduction to the UnQLite Embedded NoSQL Database Engine

  • database nosql embedded key-value-store

UnQLite is an embedded NoSQL database engine. It's a standard Key/Value store similar to the more popular Berkeley DB and a document-store database similar to MongoDB with a built-in scripting language called Jx9 that looks like Javascript. Unlike most other NoSQL databases, UnQLite does not have a separate server process. UnQLite reads and writes directly to ordinary disk files. A complete database with multiple collections is contained in a single disk file. The database file format is cross-platform, you can freely copy a database between 32-bit and 64-bit systems or between big-endian and little-endian architectures.

Read More


Exonum Blockchain Framework by the Bitfury Group

  • blockchain bitcoin hyperledger blockchain-framework

Exonum is an extensible open source blockchain framework for building private blockchains which offers outstanding performance, data security, as well as fault tolerance. The framework does not include any business logic, instead, you can develop and add the services that meet your specific needs. Exonum can be used to build various solutions from a document registry to a DevOps facilitation system.

Read More


Univention Corporate Server - An open source identity management system

  • ucs identity-management-system

Univention Corporate Server is an open source identity management system, an IT infrastructure and device management solution and an extensible platform with a store-like App Center that includes tested third party applications and further UCS components: This is what Univention combines in their main product Univention Corporate Server, a Debian GNU/Linux based enterprise distribution. This article provides you the overview of Univention Corporate Server, its feature and installation.

Read More


Appserver.io – The First Multithreaded Application Server for PHP written in PHP

  • appserver application-server php

What if you could reliably run PHP without Nginx or Apache, but also without relying on its internal server? What if you could do async operations in PHP with true multi threading, fully taking advantage of multi core processors without hacks or a jungle of callbacks? What if you had drag and drop installation support for your PHAR packaged web apps in an environment identical to its production counterpart? Welcome to appserver.io – the worlds first open source application server for PHP.

Read More


Various tools to work with Git version control

  • scm git repository solution tools-used

Git is the most popular SCM, initially developed to manage source of Linux kernel. Later many clients and tools are developed for Git. In this article we going to see various tools to use with Git.

Read More


Web based commenting system. Embed directly in to your site

  • comment free commenting-system

Comments are very important for a blog or website to get feedback from their users. Comments could be threaded where users could be discuss and post reply to the comment. Here we going discuss about the most popular and widely used free commenting system. You need to embed their javascript code in your every page and it will take care the rest of the task.

Read More


Free Open Source Code Search Engines

  • code-search code-search-engine search-engine

There are couple of sites which indexes the open source code and provides support to search code. Recently Google announced that they removed code search support from Google code. This article provides pointer for code search engine sites.

Read More


Whats new in Lucene / Solr 4.0

  • lucene solr new-release

The release 4.0 is one of the important milestone for Lucene and Solr. It has lot of new features and performance important. Few important ones are highliggted in this article.

Read More


Ngnix - High Performance Web Server, Proxy Server, Content Cache and Reverse Proxy

  • load-balancer proxy-server web-server

Nginx is a High Performance Web Server, Proxy Server, Content Cache and Reverse Proxy server. It can also be used as mail proxy server and a generic TCP/UDP proxy server. Nginx claims to be more efficient and faster in the Web space compared to the other web servers. This can be evident with the architecture which is based on asynchronous event-driven approach. The event driven architecture enables to scale to hundreds / thousands of concurrent connections.

Read More


Git vs Subversion

  • version-control subversion git

Git and Subversion are most popular and widely used version control system. What is the best situation to choose them? It is important to know its pros and cons, evaluate your requirement and choose the right one.

Read More


Scale up vs Scale out. First decision to make before moving to cloud

  • cloud scale-up scale-out scalability

Before moving to cloud, First decision to make is whether Scale up the hardware or Scale out with multiple systems. Both has its pros and cons.

Read More