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


Sponsored:
To find embedded technology information about MCU, IoT, AI etc Check out embedkari.com.


   

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

Subscribe to our newsletter.

We will send mail once in a week about latest updates on open source tools and technologies. subscribe our newsletter



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


Getting Started on Angular 7

  • angular ui-ux front-end-framework

Angular is a platform for building responsive web, native desktop and native mobile applications. Angular client applications are built using HTML, CSS and Typescript. Typescript is a typed superset of Javascript that compiles to plain Javascript. Angular core and optional modules are built using Typescript. Code has been licensed as MIT License.

Read More


Top 3 color quantization algorithms

  • color-optimization color-quantization algorithm

I have been writing on the desktop image processing application. At the version 1.0, I use the octree color quantization algorithm to reduce image to 256 colors, which is highly memory efficient with each pixel assigned the color at the center of the octree bin in which it falls. On the other hand, generates the palette using the distribution of colors in the image, but it does not consider the frequency of color. This means that if an image is composed of similar colors overall but has many different low-frequency colors or noise, octree's results can be very poor.

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


Best open source Text Editors

  • text-editor editor tools dev-tools

Text editors are mainly used by programmers and developers for manipulating plain text source code, editing configuration files or preparing documentation and even viewing error logs. Text editors is a piece of software which enables to create, modify and delete files that a programmer is using while creating website or mobile app.In this article, we will discuss about top 7 all-round performing text editors which is highly supportive for programmers.

Read More


Holistic usage guide for OpenSSL

  • openssl security certificate tools

OpenSSL is a general purpose cryptographty toolkit that provides an open source implementation of Transport Layer Security(TLS) and Secure Socket Layer(SSL) protocols. It is written in C,assembly and Perl language but wrappers are available in all languages. This article explains about OpenSSL commands.

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


Introduction to Apache Cassandra

  • cassandra database nosql

Apache Cassandra was designed by Facebook and was open-sourced in July 2008. It is regarded as perfect choice when the users demand scalability and high availability without any impact towards performance. Apache Cassandra is highly scalable, high-performance distributed database designed to handle large voluminous amounts of data across many commodity servers with no failure.

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


Advanced Programming Guide in Redis using Jedis

  • redis jedis advanced-guide cluster pipline publish-subscribe

Redis is an in-memory data structure store, used as a database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes with radius queries and streams. This blog covers the advanced concepts like cluster, publish and subscribe, pipeling concepts of Redis using Jedis Java library.

Read More


Light4j Cookbook - Rest API, CORS and RDBMS

  • light4j sql cors rest-api

Light 4j is a fast, lightweight and cloud-native microservices framework. In this article, we will see what and how hybrid framework works and integrate with RDMS databases like MySQL, also built in option of CORS handler for in-flight request.

Read More


RESTEasy Advanced Guide - Filters and Interceptors

  • resteasy rest-api filters interceptors java

RESTEasy is JAX-RS 2.1 compliant framework for developing rest applications. It is a JBoss project that provides various frameworks to help you build RESTful Web Services and RESTful Java applications. It is a fully certified and portable implementation of the JAX-RS 2.1 specification, a JCP specification that provides a Java API for RESTful Web Services over the HTTP protocol.

Read More


8 Reasons Why Python Scores Over PHP for Web Development

  • python php web-development

PHP, the general-purpose scripting language has been used since decades for socket programming and web development. But in recent times, Python has become the most sought after programming language. This all-purpose programming language is attracting more developers in the industry owing to its highly dynamic and extensible nature. Let's see how Python is winning over age-old PHP.

Read More