AMP Android SDK: Android TV UI Integration

Document created by Jason Gamboa Employee on Jan 6, 2017Last modified by Orlando Sanchez Martinez on Apr 27, 2018
Version 7Show Document
  • View in full screen mode


The rest of this guide assumes you have successfully integrated AMP's Core (you are able to play back a video). 


Getting started

For reference, check the TVUISample Android Studio sample project in the release package.
To integrate the plugin into your app, you need to:


1) Add the amp-ui-tv.aar to your project's /libs folder.

2) Copy the following lines in your runnable module build.gradle file

compile(name:'amp-ui-tv', ext:'aar')
compile ''
compile ''


3) In the Activity where playback is handled, import the following Java packages:

import com.akamai.uitv.MediaControlBarManager;
import com.akamai.uitv.MediaPlayerController;


4) Implement the MediaControlBarManager.OnRemoteControlActionsListener callback in the Activity that handles the playback, this will allow you to receive actions related to the TV's remote control:

public boolean onRemoteActionReceived(MediaControlBarManager.RemoteControlAction action){
      switch (action) {
            case PLAY:
                  return true;
            case PAUSE:
                  return true;
            case FAST_FORWARD:
                  return true;
            case REWIND:
                  return true;
            case CAPTION_ON:
                  return true;
            case CAPTION_OFF:
                  return true;
                  return false;


5) Implement two instances of the following objects:

private MediaPlayerController mediaPlayerController;
private MediaControlBarManager mediaControlBarManager;


6) Create a View type fragment on the activity's xml layout as follows:

    android:layout_height="match_parent" />


7) Create an instance of the Fragment controller in the code as follows:

mediaPlayerController = (MediaPlayerController)


8) On the onResourceReady() callback, create an instance of the Controller Manager and set the VideoPlayerView object to it:

mediaControlBarManager = new MediaControlBarManager(this, this, mediaPlayerController);
1 person found this helpful