Show Rewarded Ad
To show a rewarded ad, call Arcplay.showRDAd(...)
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:
activity
Activity
activity context
customData
String
Publisher can set any string e.g. streakId which at onUserRewarded
will be sent to publisher via the backend callback.
The accepted values are:
null
: not allowed""
: allowedMax length 4096
listener
RewardedAdEventListener
Implement these callbacks in the app for best user expereince.
AdNotReady
AdDisplayFailed
AdDisplayed
AdClicked
AdDismissed
OnUserRewarded
Note: These callbacks can also be used for instrumentation purpose.
NOTE:
It is recommended that
Arcplay.showRDAd(...)
should be called after some delay ofArcplay.init(...)
as Rewarded Ads takes some to load because it's a network call for fetching and caching the ads.If you receive
AdNotReady
callback then retry after some delay.
Last updated