> ## Documentation Index
> Fetch the complete documentation index at: https://guide.daro.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Rewarded Video Ads

> Implement rewarded video ads in your Android app.

## Rewarded Video Ad Format

Provides in-app rewards (currency, features, content) in exchange for watching video ads. Videos are non-skippable and typically run 30 seconds.

<img src="https://mintcdn.com/delightroom-5a71a6a8/j3-znW7LKrbpP3mb/sdk-integration/common-img/ad-formats-en/rv-example-image.png?fit=max&auto=format&n=j3-znW7LKrbpP3mb&q=85&s=05e99c43024f69661838e187b20caf06" alt="Rv Example Image Pn" title="Rv Example Image Pn" style={{ width:"38%" }} width="720" height="1560" data-path="sdk-integration/common-img/ad-formats-en/rv-example-image.png" />

### How It Works

<img src="https://mintcdn.com/delightroom-5a71a6a8/j3-znW7LKrbpP3mb/sdk-integration/common-img/ad-formats-en/rv-example-gif.gif?s=d1b005af49b37b3c1306ef47728165bb" alt="Rv Example Gif Gi" title="Rv Example Gif Gi" style={{ width:"38%" }} width="180" height="390" data-path="sdk-integration/common-img/ad-formats-en/rv-example-gif.gif" />

***

## Integrating Ads

<Steps>
  <Step title="Create adUnit">
    ```kotlin theme={null}
    val adUnit = DaroRewardedAdUnit(
        key = ${AdUnitId},
        placement = ${placement}, //Name displayed in logs. Can be left empty.
    )
    ```
  </Step>

  <Step title="Create Loader and load ad">
    ```kotlin theme={null}
    val loader = DaroRewardedAdLoader(
        context = context,
        adUnit = adUnit
    )
    loader.setListener(object : DaroRewardedAdLoaderListener {
        override fun onAdLoadSuccess(ad: DaroRewardedAd, adInfo: DaroAdInfo) {
            // ...
        }
        override fun onAdLoadFail(err: DaroAdLoadError) {
            // ...
        }
    })
    loader.load()
    ```
  </Step>

  <Step title="Set listener and show ad">
    ```kotlin theme={null}
    loader.setListener(object : DaroRewardedAdLoaderListener {
        override fun onAdLoadSuccess(ad: DaroRewardedAd, adInfo: DaroAdInfo) {
            ad.setListener(object : DaroRewardedAdListener {
                override fun onShown(adInfo: DaroAdInfo) {}
                override fun onFailedToShow(adInfo: DaroAdInfo, error: DaroAdDisplayFailError) {}
                override fun onDismiss(adInfo: DaroAdInfo) {}
                override fun onEarnedReward(adInfo: DaroAdInfo, rewardItem: DaroRewardedAd.DaroRewardedItem) {}
            })
            ad.show(activity = this@MainActivity)
        }
        override fun onAdLoadFail(err: DaroAdLoadError) {}
    })
    ```
  </Step>

  <Step title="Call destroy after ad viewing is complete">
    ```kotlin theme={null}
    ad.destroy()
    ```
  </Step>
</Steps>

<Info>
  You can set the server callback method as follows:

  ```kotlin {4,5} theme={null}
    loader.setListener(object : DaroRewardedAdLoaderListener {
        override fun onAdLoadSuccess(ad: DaroRewardedAd, adInfo: DaroAdInfo) {
            ...
            Daro.setUserId(context = context, ${user_id})
            ad.setCustomData(${custom_data})
            ...
        }
        ...
    })
  ```
</Info>

***

## Example

```kotlin expandable theme={null}
private fun showRewardAd() {
    DaroRewardedAdLoader(
      context = context,
      adUnit = DaroRewardedAdUnit(
        key = ${AdUnitId},
        placement = ${placement}
      )
    ).apply {
      setListener(
        object : DaroRewardedAdLoaderListener {
          override fun onAdLoadSuccess(ad: DaroRewardedAd, adInfo: DaroAdInfo) {
            Log.d("Ad Test", "rewarded - success")

            ad.setListener(
              object : DaroRewardedAdListener {
                override fun onShown(adInfo: DaroAdInfo) {
                  Log.d("Ad Test", "rewarded - onShown")
                }

                override fun onFailedToShow(
                  adInfo: DaroAdInfo,
                  error: DaroAdDisplayFailError,
                ) {
                  Log.d("Ad Test", "rewarded - onFailedToShow")
                }

                override fun onDismiss(adInfo: DaroAdInfo) {
                  Log.d("Ad Test", "rewarded - onDismiss")
                  ad.destroy()
                }

                override fun onEarnedReward(
                  adInfo: DaroAdInfo,
                  rewardItem: DaroRewardedAd.DaroRewardedItem,
                ) {
                  Log.d("Ad Test", "rewarded - onEarnedReward")
                }
              },
            )

            Daro.setUserId(context = context, ${user_id})
            ad.setCustomData(${custom_data})

            ad.show(activity = this@MainActivity)
          }
        })
      load()
    }
  }
```

***

## Troubleshooting: Ad Close Button Overlap Issue

<Warning>
  When displaying rewarded ads using the DARO Android SDK, some ad creatives may visually overlap with the Status Bar or display cutout (notch, punch-hole) area.
  The following guide shows how to hide the Status Bar only while the ad is displayed and restore it once the ad is dismissed.
</Warning>

```kotlin theme={null}
// Before showing ad - hide status bar
private fun hideStatusBar(activity: Activity) {
    WindowCompat.setDecorFitsSystemWindows(activity.window, false)
    WindowInsetsControllerCompat(activity.window, activity.window.decorView).apply {
        hide(WindowInsetsCompat.Type.statusBars())
        systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
    }
}

// After ad closes - restore status bar
private fun showStatusBar(activity: Activity) {
    WindowCompat.setDecorFitsSystemWindows(activity.window, true)
    WindowInsetsControllerCompat(activity.window, activity.window.decorView).apply {
        show(WindowInsetsCompat.Type.statusBars())
    }
}
```

Apply it in the ad listener as follows:

```kotlin theme={null}
ad.setListener(object : DaroRewardedAdListener {
    override fun onShown(adInfo: DaroAdInfo) {
        hideStatusBar(activity)  // Defensive re-hide
    }
    override fun onFailedToShow(adInfo: DaroAdInfo, error: DaroAdDisplayFailError) {
        showStatusBar(activity)  // Restore on failure
    }
    override fun onDismiss(adInfo: DaroAdInfo) {
        showStatusBar(activity)  // Restore on dismiss
        ad.destroy()
    }
    override fun onEarnedReward(adInfo: DaroAdInfo, rewardItem: DaroRewardedAd.DaroRewardedItem) {}
})

hideStatusBar(activity)  // Call just before show()
ad.show(activity = this@MainActivity)
```
