Skip to content

Android TV

Integration for Android TV televisions and set-top boxes. The code is the same as for Android; the differences are the address, the set of controls, and remote-control input.

What changes

AndroidAndroid TV
Address…/android/v3/…/androidtv/v3/
InputTouchRemote: arrows, OK
Controlsad-skip-btn, ad-click-btn, ad-more-menu, ad-disable-btnad-skip-btn, ad-click-btn, ad-disable-btn, ad-info, ad-notice
ERID and advertiserIn the "Learn more" menuAlways on screen (ad-info)

Screen layout

The screen looks the same in the Playground with the Android TV platform: it renders the SDK at 960×540, matching a 1080p television.

Remote control

  • When the WebView gets focus, the SDK moves it to the ad-disable-btn button, if that control is enabled.
  • The OK and Enter buttons activate the focused element.
  • To move focus to an interactive VPAID creative, call window.myAdController.setFocusToPlayer().

Give focus to the WebView

Only the focused View receives remote-control input. Call webView.requestFocus() right after opening the ad, or the SDK buttons won't respond.

kotlin
webView.isFocusable = true
webView.isFocusableInTouchMode = true
webView.loadUrl(adPageUrl)
webView.requestFocus()

Back button

The ad doesn't close itself on the Back button. Decide what it should do in your app — for example, allow exiting only after AdSkippableStateChanged(true):

kotlin
private var isSkippable = false      // true after AdSkippableStateChanged(true)

override fun onBackPressed() {
    if (isSkippable) sdk("skipAd()")   // until then, Back does nothing
}

Everything else — the player, events, timeupdateAd() — works as on Android.