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
| Android | Android TV | |
|---|---|---|
| Address | …/android/v3/ | …/androidtv/v3/ |
| Input | Touch | Remote: arrows, OK |
| Controls | ad-skip-btn, ad-click-btn, ad-more-menu, ad-disable-btn | ad-skip-btn, ad-click-btn, ad-disable-btn, ad-info, ad-notice |
| ERID and advertiser | In the "Learn more" menu | Always on screen (ad-info) |
Screen layout
ad-noticead-click-btn
Ad creative · app player
ad-info ERID · advertiser
ad-skip-btnad-disable-btn
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-btnbutton, 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.