---
agentTools:
  projectIndex: https://developers.appnext.com/llms.txt
---

# FullScreen Video Integration Guide

Appnext Android SDK 2.0 supports FullScreen Video ads, a full-screen video ad unit recommended for high-impact placements and natural breaks in the user experience.

## Step 1.  Create a FullScreen Video Ad

Create a FullScreenVideo instance using your Appnext placement ID.:

```kotlin
val fullScreenVideo = FullScreenVideo("YOUR_PLACEMENT_ID")
```

## Step 2. Load the FullScreen Video Ad

Call loadAds() before showing the ad.

```kotlin
fullScreenVideo.loadAds(context)
```

With optional load callback:

```kotlin
fullScreenVideo.loadAds(
    context = context,
    listener = object : FullScreenVideoLoadCallback {
        override fun onFullScreenVideoLoaded() {
            // Ad loaded successfully
        }

        override fun onFullScreenVideoLoadError(error: AppnextError) {
            // Ad failed to load
        }
    }
)
```

Optional search keyword:

```kotlin
fullScreenVideo.loadAds(
    context = context,
    searchKeyWord = "games"
)
```

## Step 3. Show the FullScreen Video Ad

**Important**: You must call loadAds() before calling showAd(). If showAd() is called before a rewarded ad is loaded, the SDK will trigger onAdError() with an fullscreen-not-loaded error.

Only after the ad has been loaded, call showAd().

```kotlin
fullScreenVideo.showAd(
    context = context,
    fullScreenVideoCallbacks = object : FullScreenVideoCallbacks {
        override fun onAdShown() {
            // Ad shown
        }

        override fun onAdClosed() {
            // Ad closed
        }

        override fun onAdClicked(packageName: String) {
            // Ad clicked
        }

        override fun onAdError(error: AppnextError) {
            // Ad failed to show
        }

        override fun onVideoEnded() {
            // Video completed
        }
    }
)
```

## Callbacks

**Load Callback**

Use FullScreenVideoLoadCallback to receive load status.

```kotlin
object : FullScreenVideoLoadCallback {
    override fun onFullScreenVideoLoaded() {}
    override fun onFullScreenVideoLoaded(error: AppnextError) {}
}
```

**Ad Callback**

Use FullScreenVideoCallbacks to receive show, close, click, and error events.

```kotlin
object : FullScreenVideoCallbacks {
    override fun onAdShown() {}
    override fun onAdClosed() {}
    override fun onAdClicked(packageName: String) {}
    override fun onAdError(error: AppnextError) {}
}
```

## Advanced Settings

Configure the ad before calling loadAds.

```kotlin
fullScreenVideo.setPostBack("YOUR_POSTBACK")
fullScreenVideo.setCategories("games,tools")
fullScreenVideo.setSpecificCategories("arcade,puzzle")
fullScreenVideo.setSearchByPackage("com.example.app")
```

Available setters:

* setPostBack - String. Postback parameters that will be posted to your server after the user installs an app.
* setCategories - String. Set preferred ad categories, comma-separated.
* setSpecificCategories - String. Set specific ad categories, comma-separated.
* setSearchByPackage - String. Set a specific Android package.

## (Optional) In-App Header Bidding

Use getECPM() to get the predicted eCPM before loading or showing an ad.

```kotlin
fullScreenVideo.getECPM(
    context = context,
    onECPMLoaded = object : OnECPMLoaded {
        override fun ecpm(ecpm: ECPM) {
            // eCPM received
        }

        override fun error(error: AppnextError) {
            // eCPM request failed
        }
    }
)
```

The ecpm object will include the following getters:

* getEcpm - Returns the predicted ECPM value of the banner that is about to be loaded (float type)
* getPpr - Returns the predicted price per request value (ECPM value / 1000) (float type)
* getCreativeId - String. Returns a unique ID of the campaign's creative.
* getAdDomain- String. Returns the Android package name.
* getCreativeUrl - String. Returns the URL of the campaign for User Acquisition campaign type, or the package name for Re-engagement campaign type.
* getCampaignID - String. Returns a unique ID of the campaign
* getCategory - String. Returns the campaign category name.

Optional search keyword

```kotlin
fullScreenVideo.getECPM(
    context = context,
    onECPMLoaded = callback,
    searchKeyword = "games"
)
```