# Fire TV and Android TV

Source: https://docs.ezoic.com/docs/ctv/fire-tv-android-tv/


This guide covers serving Ezoic video ads from Fire TV and Android TV apps with Google's Interactive Media Ads (IMA) SDK for Android. Any VAST-capable player works the same way. Only the code differs.

## Tag template

```
https://g.ezoic.net/ezoic/videoad/vast?bundle=<PACKAGE_NAME>&app_domain=<YOUR_EZOIC_DOMAIN>&app_name=<APP_NAME>&storeurl=<STORE_URL>&adunit=<YOUR_VIDEO_AD_UNIT>&ifa=<ADVERTISING_ID>&ifa_type=<afai|aaid>&lmt=<0|1>&devicetype=3&plcmt=1&v=4&w=1920&h=1080&startdelay=0&content_id=<ID>&content_title=<TITLE>&content_genre=<GENRE>&content_cat=<IAB_CAT>&content_len=<SECONDS>&livestream=<0|1>&us_privacy=<USP>&cb=<RANDOM>
```

| | Fire TV | Android TV |
|---|---|---|
| `bundle` | Package name, for example `com.example.tvapp` | Package name |
| `storeurl` | Amazon Appstore listing URL | Google Play listing URL |
| `ifa` source | Fire OS advertising ID | Google advertising ID from the platform client |
| `ifa_type` | `afai` | `aaid` |
| `lmt` source | The limit-ad-tracking setting | The platform's limit-ad-tracking flag |

`v=4` works with IMA, which parses VAST 4.x. Use `v=3` if the same tag also goes to players that parse only VAST 3.

## IMA SDK integration (Kotlin)

```kotlin
val sdkFactory = ImaSdkFactory.getInstance()
val adsLoader = sdkFactory.createAdsLoader(context, sdkFactory.createImaSdkSettings(), adDisplayContainer)

val request = sdkFactory.createAdsRequest().apply {
    adTagUrl = buildEzoicTagUrl(video)
    contentDuration = video.durationSeconds.toFloat()
}
adsLoader.requestAds(request)
```

Build the tag URL with real values, and URL-encode every field. Fetch the advertising ID off the main thread, because the platform call blocks.

When limit ad tracking is on, the platform returns a zeroed advertising ID. Send `lmt=1` with the ID exactly as returned. Do not substitute an ID of your own.

## Open Measurement

IMA bundles the Open Measurement SDK, and OM sessions run automatically for VAST ads that carry verification resources. The tag declares OMID support for non-Roku CTV requests, so you do not need to send `api`. If your app runs its own OM SDK session outside IMA, also send `omidpn` and `omidpv`.

## Behaviour notes

- An empty VAST document is a no-fill. IMA raises its "VAST response empty" error. Treat it as a fall-through to content, not a failure.
- The endpoint is CORS-enabled and needs no special headers, so WebView-based players can use it too.
- Request again at each break with `startdelay` set. Send `pod` and `slot` for multi-ad breaks.

## Go-live checklist

- [ ] `bundle` is the exact package name, the store listing is live, and app-ads.txt is on your developer domain
- [ ] `ifa` comes from the platform API, and `ifa_type` is `afai` on Fire TV or `aaid` on Android TV
- [ ] `lmt` is wired to the platform's limit-ad-tracking state
- [ ] `devicetype=3`, real `w` and `h`, and `startdelay` are sent
- [ ] `adunit` is set to your normal video ad unit name
- [ ] Content metadata is populated from your catalog
- [ ] The app is registered under Mobile & CTV Apps

