> For the complete documentation index, see [llms.txt](https://arcplay-ai.gitbook.io/knowledge-portal/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://arcplay-ai.gitbook.io/knowledge-portal/for-consumer-apps/unlock-with-ads/engineering-team/sdk-integration/android/show-rewarded-ad.md).

# Show Rewarded Ad

To show a rewarded ad, call `Arcplay.showRDAd(...)`&#x20;

```kotlin
val customData = "<<Publisher can set any string e.g. streakId>>"

Arcplay.showRDAd(this, customData, object :
    RewardedAdEventListener {
        
        override fun onAdNotReady() {
            Log.i("UnlockWithAds", "Ad not ready")
            // Rewarded ad is not loaded yet, or ArcPlay init is not successful yet
            // ArcPlay recommends that you retry with exponentially higher delays
        }
        
        override fun onAdDisplayFailed() {
            Log.i("UnlockWithAds", "Ad failed to display")
            // Rewarded ad was loaded successfully but failed to display
            // ArcPlay recommends that you retry with exponentially higher delays
        }

        override fun onAdDisplayed() {
            Log.i("UnlockWithAds", "Ad displayed")
            // Rewarded ad was displayed successfully
            // ArcPlay recommends that you pause the user flow
        }

        override fun onAdClicked() {
            Log.i("UnlockWithAds", "Ad clicked")
            // User clicked on rewarded ad and user went out of the app
        }

        override fun onAdDismissed() {
            Log.i("UnlockWithAds", "Ad dismissed")
            // User dismissed the rewarded ad
            // ArcPlay recommends that you resume the user flow
        }
        
        override fun onUserRewarded() {
            Log.i("UnlockWithAds", "User rewarded")
            // User should receive the reward
            // ArcPlay shall send the s2s callback for processing the reward 
        }
    })
}
```

The default function parameters include:

| Param      | Type                    | Description                                                                                                                                                                                                                                                                                                                                                                |
| ---------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| activity   | Activity                | activity context                                                                                                                                                                                                                                                                                                                                                           |
| customData | String                  | <p>Publisher can set any string e.g. streakId which at <code>onUserRewarded</code> will be sent to publisher via the backend callback. </p><p></p><p>The accepted values are:</p><ul><li><code>null</code>: not allowed</li><li><code>""</code> : allowed </li><li>Max length 4096</li></ul>                                                                               |
| listener   | RewardedAdEventListener | <p></p><p>Implement these callbacks in the app for best user expereince. </p><ul><li><code>AdNotReady</code></li><li><code>AdDisplayFailed</code></li><li><code>AdDisplayed</code></li><li><code>AdClicked</code></li><li><code>AdDismissed</code></li><li><code>OnUserRewarded</code></li></ul><p>Note: These callbacks can also be used for instrumentation purpose.</p> |

NOTE:

1. It is recommended that `Arcplay.showRDAd(...)` should be called after some delay of `Arcplay.init(...)` as Rewarded Ads takes some to load because it's a network call for fetching and caching the ads.
2. If you receive `AdNotReady` callback then retry after some delay.
