SearchFragment
– Android TV app hands on Tutorial 12

search3-2015-09-02-210633

In-app Search on Android TV application One of the biggest difference between Android phone & Android TV is their input method. Since TV does not support touchpad, and we shouldn’t expect users to use keyboard for TV, inputting words for TV is troublesome. Google suggests to use voice input for in Searching within TV Apps   In-app Search icon on BrowseFragment BrowseFragment contains a design layout for search function as well, and showing in-app icon on your application is very easy. Just implement setOnSearchClickedListener, that’s all.

setSearchAffordanceColor method can be used for specifying search icon color.

    SearchFragment Search function need to be implemented to answer user’s search query. To show […]

Continue reading →

Recommendation card
– Android TV app Tutorial hands on 11

recommendation

Recommendation Android TV’s home, LeanbackLauncher has a recommendation row at first row. Any application can suggest recommended contents for users. In this chapter, I will explain how to show recommendation card to LeanbackLauncher from your application. Recommending TV Content – Android developers Android TV Recommendations: What’s in it for my app or game? This recommendation is achieved by using Notification framework whose structure was already existed in Android phone/tablet SDK. So showing recommendation in LeanbackLauncher is actually sending notification. Basic sequence is following  Declare NotificationManager Use your customized RecommendationBuilder class (it is custom class which usesNotificationCompat class)  to prepare recommendation. Make Notification by building RecommendationBuilder Notify this Notification using NotificationManager.   What is implemented […]

Continue reading →

GuidedStepFragment
– Android TV app hands on tutorial 10

FirstStepFragment

GuidedStepFragment to show Settings display Leanback support library offers a Fragment. Especially, it is useful to use in settings display. Official doc says, A GuidedStepFragment is used to guide the user through a decision or series of decisions.  I also recommend you to read these references for this topic. GuidedStepFragment – official Android developwers site Building for Android TV – Episode 4 Create GuidedStepActivity & Implement onItemClicked in MainFragment At first, create GuidedStepActivity by right click your package name New → Java Class → type “GuidedStepActivity” in class name. Note that this GuidedStepActivity doesn’t require res/layout xml file, so it is ok to only create Java class. Make this class […]

Continue reading →

Can we control background video playback on Leanback Launcher by remote controller?

I’m testing Google’s sample app https://github.com/googlesamples/androidtv-Leanback. After start playing video and go back to Leanback Launcher home display, it keeps playing in background with now playing card. I found pause key stops background video and changes back to normal background, and only after that MediaSession callback is working.After background changes to normal Leanback Launcher background paper, play/pause button changes the video status of now playing card, However background is not video but normal display… Is there a way to show video in background with this condition? See below video for the behavior I’m writing about. When background video playback changes to normal background, I’m pressing pause button on Leanback Launcher display. After that, […]

Continue reading →

How to enable developer mode in Android TV

Android TV is of course Android, so we can enable developer mode in the same way with Android phones & tablets. Go to “Settings” at the bottom of LeanbackLauncher Select “About” icon at the top row, most right side Press “Build” button, located at the bottom for 7 times. Go back “Home” and Go to “Settings” again, Developer options are now available on the System Preferences row, right most side. That’s all!   Appendix By the way, each Android version have hidden playful app, you can check it on your Android TV as well. Go to Settings → About → Version and press Version for many times, you can enjoy […]

Continue reading →

Install Android phone’s application to Android TV

[2016.3.13 added] This post explains sideloading apps via USB. It is also possible to transfer file via Wifi. See Install Android phone’s app on Android TV via Wifi. Extract & install apk file using ES file explorer If you have Android phone, you can extract .apk file (Android application file) and try to move it to your Android TV. I recommend to use “ES file explorer” to extract & install apk file. Get apps that you want to install in your Android phone from Google play. Get .apk file from Your Android phone using ES file explorer app on Android phone. <Reference> – Using ES File Explorer To Make APK Backups […]

Continue reading →

MediaSession & MediaController
– Android TV app hands on Tutorial 9

Video Controls implementation with MediaSession The sample implementation is done in Google’s latest sample Android TV application. AOSP sample application implementation does not have MediaSession implementation yet (in API 21, 22). In previous chapter, I explained that following Video controls are needed to be impmented. Action’s UI update part (done in previous chapter) Video control part (done in previous chapter) MediaSession implementation, Video control via MediaController’s TransportControls (this chapter) – MediaSession can handle the action when user presses TV remote controller’s video control button. – It allows other activity to inherite video control. Especially LeanbackLauncher, Home display, can play video in background.   set MediaMetadata to MediaSession (this chapter) – “Now playing card” will appear at […]

Continue reading →

Video Controls minimum implementation
– Android TV app hands on Tutorial 8

action_icon_change-2015-07-21-164408

Video Controls minimum implementation Video is streamed in VideoView. * I referred Google’s latest sample Android TV application. AOSP sample application implementation is defferent. For Video controls, we have several stuff to explain. Action’s UI update part (this chapter) Video control part (this chapter) MediaSession implementation, Video control via MediaController’s TransportControls (next chapter)– MediaSession can handle the action when user presses TV remote controller’s video control button.– It allows other activity to inherite video control. Especially LeanbackLauncher, Home display, can play video in background.   set MediaMetadata to MediaSession (next chapter) – “Now playing card” will appear at the top of recommendation row. In this chapter, Video controls implementation is explained. Since Google’s sample […]

Continue reading →

PlaybackOverlayActivity & PlaybackOverlayFragment
– Android TV application hands on tutorial 7

PlaybackOverview1-2015-07-14-200711

PlaybackOverlayActivity & PlaybackOverlayFragment – Theory I will explain about only UI part in this chapter, video control is explained in next chapter. We will implement UI for handling video contents.   PlaybackOverlayActivity & PlaybackOverlayFragment – Implementation Creating PlaybackOverlayActivity & PlaybackOverlayFragment is the same way as in introduced previously. PlaybackOverlayActivity New → Activity → BlankActivity Activity Name: PlaybackOverlayActivity Layout Name: activity_playback_overlay  … This PlaybackOverlayActivity will refer activity_playback_overlay.xml file in res/layout folder. It is constructed in 2 layer – VideoView in the back and PlaybackOverlayFragment in the front. VideoView is the view which we will play video contents, and PlaybackOverlayFragment will show the UI for controlling video, which we will focus on in this […]

Continue reading →