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

Displays an ad as a popup over your app screen.

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

***

## Integrating Ads

Initialize the SDK as described in [Get started](/en/sdk-integration-v2/android/get-started). Replace `YOUR_AD_UNIT_ID` in the examples with the dashboard Ad Unit Key for this format.

<Steps>
  <Step title="Create adUnit">
    ```kotlin theme={null}
    val adUnit = DaroLightPopupAdUnit(
        key = "YOUR_AD_UNIT_ID",
        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: DaroError) {
            // ...
        }
    })
    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: DaroError) {}
    })
    ```
  </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 = "YOUR_AD_UNIT_ID",
    )
  ).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.destroy()
          }
        })

        ad.show(activity = this@MainActivity)
      }

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