> ## 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.

# Light Popup Ads

> Implement light popup ads in your Android app.

## Light Popup Ad Format

Full-screen ad format that automatically closes after 8 seconds. Less disruptive to UX than interstitial or rewarded video ads.

<img src="https://mintcdn.com/delightroom-5a71a6a8/j3-znW7LKrbpP3mb/sdk-integration/common-img/ad-formats-en/android-light-popup-example.png?fit=max&auto=format&n=j3-znW7LKrbpP3mb&q=85&s=6378227c2a143eebe1d9c2ca1f6d1b3c" alt="Android Light Popup Example Pn" title="Android Light Popup Example Pn" style={{ width:"40%" }} width="1080" height="2400" data-path="sdk-integration/common-img/ad-formats-en/android-light-popup-example.png" />

***

## Integrating Ads

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

    <Expandable title="DaroLightPopupAdOptions">
      <ResponseField name="backgroundColor" type="Int">
        Overall background color
      </ResponseField>

      <ResponseField name="containerColor" type="Int">
        Popup container background color
      </ResponseField>

      <ResponseField name="adMarkLabelTextColor" type="Int">
        Top ad mark text color
      </ResponseField>

      <ResponseField name="adMarkLabelBackgroundColor" type="Int">
        Top ad mark background color
      </ResponseField>

      <ResponseField name="titleColor" type="Int">
        Title text color
      </ResponseField>

      <ResponseField name="bodyColor" type="Int">
        Body text color
      </ResponseField>

      <ResponseField name="ctaBackgroundColor" type="Int">
        CTA (button) background color
      </ResponseField>

      <ResponseField name="ctaTextColor" type="Int">
        CTA (button) text color
      </ResponseField>

      <ResponseField name="closeButtonText" type="String">
        Close button text
      </ResponseField>

      <ResponseField name="closeButtonColor" type="Int">
        Close button text color
      </ResponseField>
    </Expandable>
  </Step>

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

  <Step title="Set listener and show ad">
    ```kotlin theme={null}
    loader.setListener(object : DaroLightPopupAdLoaderListener {
        override fun onAdLoadSuccess(ad: DaroLightPopupAd, adInfo: DaroAdInfo) {
            ad.setListener(object : DaroLightPopupAdListener {
                override fun onAdImpression(adInfo: DaroAdInfo) {}
                override fun onAdClicked(adInfo: DaroAdInfo) {}
                override fun onShown(adInfo: DaroAdInfo) {}
                override fun onFailedToShow(adInfo: DaroAdInfo, error: DaroAdDisplayFailError) {}
                override fun onDismiss(adInfo: DaroAdInfo) {}
            })
            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>

***

## Example

```kotlin expandable theme={null}
private fun showLightPopupAd() {
  DaroLightPopupAdLoader(
    context = context,
    adUnit = DaroLightPopupAdUnit(
      key = ${AdUnitId},
      placement = ${placement}
    )
  ).apply {
    setListener(object : DaroLightPopupAdLoaderListener {
      override fun onAdLoadSuccess(
        ad: DaroLightPopupAd,
        adInfo: DaroAdInfo,
      ) {
        Log.d("Ad Test", "lightpopup - success")

        ad.setListener(object : DaroLightPopupAdListener {
          override fun onAdImpression(adInfo: DaroAdInfo) {
            Log.d("Ad Test", "lightpopup - impression")
          }

          override fun onAdClicked(adInfo: DaroAdInfo) {
            Log.d("Ad Test", "lightpopup - clicked")
          }

          override fun onShown(adInfo: DaroAdInfo) {
            Log.d("Ad Test", "lightpopup - onShown")
          }

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

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

        ad.show(activity = this@MainActivity)
      }

      override fun onAdLoadFail(err: DaroAdLoadError) {
        Log.d("Ad Test", "lightpopup - fail : ${err.message}")
      }
    }
    )
    load()
  }
}
```
