Testing YouTube Android Player API on Android phone & Android TV


  I tested YouTube Android Player API on Android TV devices. Sadly it is not working well with Android TV’s YouTube app (“YouTube for Android TV”). Only YouTube App Launcher Intents works well for now (2016.1.14). YouTube Android Player API YouTube Android Player API is an official library on Google Developers web site, which enables us to integrate YouTube functionality into our (third party’s) Android apps. We can control YouTube video/playlist playback from our app, and customize playback view using YouTube Android Player API. YouTube app must be installed on user’s device As written in the official page, How it works The API client library interacts with a service that is distributed […]

Continue reading →

– Android TV application hands on tutorial 19


Showing icons on vertical alignment We learned BrowseFragment to show icons, where icons are aligned horizontally when the size increases. VerticalGridFragment is another Fragment provided by leanback support library, where it shows the icons with vertical alignment.   For example, I guess Sideload Launcher – Android TV is using this VerticalGridFragment to show installed app icons.  This post explains how to implement VerticalGridFragment. The implementation is referenced from Google’s sample implementation in the same way as before. Create parent Activity – VerticalGridActivity Starting by creating Activity. right click on “ui” package, [New] → [Activity] → [Blank Activity], type Activity Name as “VerticalGridActivity” and click [Finish]. It will automatically create VerticalGridActivity class, activity_vertical_grid.xml layout resource and add this […]

Continue reading →

BrowseFragment ListRow customization
– Android TV application hands on tutorial 18


More customization of BrowseFragment – Multiple rows icon alignment on ListRow Continuing from the previous chapter, BrowseFragment Header customization, I proceed to customizing ListRow. Chapter 17: Customizing Header Chapter 18: Customizing ListRow (we are here!) Leanback Launcher app shows multiple rows in Apps, Games bar if the number of icon is many (2 rows are used for “Apps” category in above picture). But original ListRow provided by Leanback support library only allows to show contents in one line. In this chapter, goal is to allow ListRow to show multiple rows in each header, by making customized class of ListRow (Model) and ListRowPresenter (Presenter). Explanation: Dig in source code  ListRow (Model), ListRowView (View), ListRowPresenter (Presenter) is used for […]

Continue reading →

BrowseFragment Header customization
– Android TV application hands on tutorial 17


More customization of BrowseFragment – Showing icon beside the Header title The basic implementation of BrowseFragment is already explained in this tutorial. I’m going to proceed some advanced customization in following chapters. Chapter 17: Customizing Header (we are here!) Chapter 18: Customizing ListRow Aim is to change the design of header, to show icons on the left of header title text, as shown in the above image. How to customize header design Leanback support library adopts MVP (Model-View-Presenter) architecture*, and HeaderItem (Model) is not an exception. We can prepare our own View and Presenter to customize the design of header. * MVP is explained in Chapter 14.  Step is as follows, Make own Model (If necessary): Java class which […]

Continue reading →

Background data loading
– Android TV application hands on tutorial 15


Background data loading using Loader class This Tutorial was explaining about Leanback support library, which is usually used to show list of contents information. So developers may want to load a many meta data to show contents. When Activity or Fragment need to prepare big size of data, it is better to load the data in background. For this purpose, we can use Loader and LoaderManager. They are useful to implement background data loading followed by updating UI based on these loaded data. I’m going to implement this Loader in this chapter. To study about Loader, I found a very nice article to understand Loader and the LoaderManager in detail (from part 1 to part 4). This post is […]

Continue reading →

Data loading from web
– Android TV application hands on tutorial 16


  * You can see the JSON video data used in this post at here: https://raw.githubusercontent.com/corochann/AndroidTVappTutorial/master/app/src/main/assets/video_lists.json  Manage data online, keep updated. In the previous chapter, Background data loading – Android TV application hands on tutorial 15, I introduced LoaderManager and Loader class which helps to load/prepare (maybe time consuming) data in background. One of the example of “time consuming” data preparation is loading data from network. If you can provide the data from the web, app can always show updated, latest information. In this chapter I will implement web data loading, to show our video contents information. We will prepare data in json format, and upload it to the web (https://raw.githubusercontent.com/corochann/AndroidTVappTutorial/master/app/src/main/assets/video_lists.json for now). It […]

Continue reading →

Fast, easy Parcelable implementation with Android studio Parcelable plugin


Starting from conclusion Use Parcelable class is always encouraged for better performance, while it is much easier to use Serializable class for fast checking/implementation. Easy & fast implementation of Parcelable? → Use Android studio plug-in! Serializable and Parcelable difference Serializable & Parcelable class can be used to pass object references from one Activity to the other Activity via Intent/Bundle. Your object must implement either  Serializable or Parcelable in order to pass it via Intent. Serializable, the Master of Simplicity Parcelable, the Speed King by Parcelable vs Serializable Serializable is defined in JAVA language as  a marker interface, so after implementing Serializable no extra method implementation is needed. It is very easy to use, but the performance is not good since serializing […]

Continue reading →

Importing Android SDK with hidden APIs

How to import ActivityManagerNative? My first motivation was to use AndroidManagerNative class, even you can find this class in Android open source project, you can’t use it in our app when you build with usual Android SDK. Yes, some of the classes are hidden in SDK. More specifically, $SDK_PATH/platforms/android-xx/android.jar contains limited APIs for Android app developers. I put memo how to use these hidden classes/methods in your Android app development from Android studio (which works with build.gradle). Building Android SDK including all APIs First step is to prepare library which includes hidden Android APIs. Below link answers how to do this. How do I build the Android SDK with hidden and […]

Continue reading →

Noticeable changes for Android Marshmallow 6.0


What has changed from Android Lollipop to Marshmallow from user point of view on Android TV? Below is the noticeable changes when I use Nexus Player with Android Marshmallow (see how to update). Precise permission control for each App When we go to [Settings] → [Apps] → Select specific app  → [Permissions], we can set to allow/disallow apps to use permissions one by one. It becomes more customizable, (I fell it too complicated though). Security patch Other than the Android software version update, it seems there’s a Android security patch update frequently. So far, the big change I can find from user point of view is only these stuffs. Followings are the […]

Continue reading →

Updating your Nexus Player to Android M 6.0

Android 6.0 Marshmallow Factory Images are released for Nexus 6, Nexus 5, Nexus 9, Nexus 7, Nexus 10, Neus4 and Nexus Player. Google Releases Android 6.0 Marshmallow Factory Images for Nexus Devices Android 6.0 Factory Images Are Live For The Nexus 5, 6, 7, 9, And Player I will explain the steps to update software of your Nexus Player to Android M. The steps should be almost similar to other Nexus devices as well.  Flashing factory image to Nexus Player Step 0. install adb and fastboot command This method is for developers since it requires Android SDK tools set up such as, “adb” and “fastboot” command. If you haven’t set up these […]

Continue reading →