Adrop
The main class of the Adrop SDK. Handles SDK initialization and global settings.Static Methods
| Method | Description |
|---|---|
initialize(context: Application, production: Boolean) | Initializes the SDK. |
initialize(context: Application, production: Boolean, targetCountries: Array<String>) | Initializes the SDK with target countries. |
initialize(context: Application, production: Boolean, targetCountries: Array<String>, tokenKey: String?) | Initializes the SDK with target countries and token key. |
setUID(uid: String) | Sets the user identifier. (Hashed with SHA-256) |
setTheme(theme: AdropTheme) | Sets the ad theme. |
setTokenKey(tokenKey: String) | Sets the app token key. |
handleDeepLink(intent: Intent): Boolean | Handles Adrop deep links. |
openQuest(context: Context, channel: String, path: String?) | Opens the Adrop Quest page. |
registerWebView(webView: WebView) | Registers a WebView for backfill ads support. Requires adrop-ads-backfill module. Call on the main thread. |
Static Properties
| Property | Type | Description |
|---|---|---|
isProduction | Boolean | Whether in production mode |
sdkVersion | String | SDK version |
consentManager | AdropConsentManager? | Consent manager instance (auto-configured when adrop-ads-backfill is installed) |
Usage Example
AdropTheme
Enum for setting dark mode for ads.Values
| Value | Description |
|---|---|
LIGHT | Light mode |
DARK | Dark mode |
AUTO | Follow system settings automatically (default) |
Usage Example
AdropErrorCode
Error codes that may occur when loading and displaying ads.Values
| Error Code | Description |
|---|---|
ERROR_CODE_NETWORK | Network error |
ERROR_CODE_INTERNAL | Internal error |
ERROR_CODE_INITIALIZE | SDK initialization error |
ERROR_CODE_INVALID_UNIT | Invalid ad unit ID |
ERROR_CODE_NOT_TARGET_COUNTRY | Not in target country |
ERROR_CODE_AD_INACTIVE | Inactive ad |
ERROR_CODE_AD_NO_FILL | No ad available to display |
ERROR_CODE_AD_BACKFILL_NO_FILL | No backfill ad available |
ERROR_CODE_AD_LOAD_DUPLICATED | Duplicate ad load request |
ERROR_CODE_AD_LOADING | Ad is loading |
ERROR_CODE_AD_EMPTY | Ad is empty |
ERROR_CODE_AD_SHOWN | Ad has already been shown |
ERROR_CODE_AD_HIDE_FOR_TODAY | ”Don’t show today” is set |
ERROR_CODE_ACCOUNT_USAGE_LIMIT_EXCEEDED | Account usage limit exceeded |
ERROR_CODE_LANDSCAPE_UNSUPPORTED | Landscape mode not supported |
AdropAdChoicesPosition
Enum for setting the AdChoices badge position on backfill native ads.Values
| Value | Description |
|---|---|
TOP_LEFT | Top-left corner |
TOP_RIGHT | Top-right corner (default) |
BOTTOM_LEFT | Bottom-left corner |
BOTTOM_RIGHT | Bottom-right corner |
Usage Example
AdropBanner
View class for displaying banner ads.Constructor
Properties
| Property | Type | Description |
|---|---|---|
listener | AdropBannerListener? | Banner event listener |
shouldAdjustHtmlStyle | Boolean | Whether to auto-adjust HTML style (default: false) |
useCustomClick | Boolean | Whether to use custom click handling (default: false) |
adSize | CreativeSize? | Banner size for backfill ads (dp) |
contextId | String | Context ID |
creativeId | String | Creative ID |
txId | String | Transaction ID |
campaignId | String | Campaign ID |
destinationURL | String | Destination URL |
creativeSize | CreativeSize | Creative size |
isBackfilled | Boolean | Whether it’s a backfill ad |
browserTarget | Int | Browser target for opening destination URL |
Methods
| Method | Description |
|---|---|
setUnitId(unitId: String) | Set ad unit ID |
getUnitId(): String | Get ad unit ID |
load() | Load ad |
open(url: String?) | Open ad landing page |
destroy() | Destroy banner ad |
Companion Methods
| Method | Description |
|---|---|
loads(context, unitId, contextId?, listener) | Batch load up to 5 banner ads — see Batch Loading |
Usage Example
AdropBannerListener
Interface for handling banner ad events.Methods
| Method | Description |
|---|---|
onAdReceived(banner: AdropBanner) | Ad received successfully |
onAdClicked(banner: AdropBanner) | Ad clicked |
onAdImpression(banner: AdropBanner) | Ad impression (optional implementation) |
onAdFailedToReceive(banner: AdropBanner, errorCode: AdropErrorCode) | Failed to receive ad |
onAdVideoStart(banner: AdropBanner) | Video playback started (optional implementation) |
onAdVideoEnd(banner: AdropBanner) | Video playback ended (optional implementation) |
onAdsReceived(banners: List<AdropBanner>) | Batch ads received from AdropBanner.loads() (optional implementation) |
onAdsFailedToReceive(errorCode: AdropErrorCode) | Batch load failed from AdropBanner.loads() (optional implementation) |
All callbacks are called on the main thread (
@UiThread).AdropNativeAd
Class for displaying native ads.Constructor
Properties
| Property | Type | Description |
|---|---|---|
unitId | String | Ad unit ID |
contextId | String? | Context ID |
listener | AdropNativeAdListener? | Native ad event listener |
useCustomClick | Boolean | Whether to use custom click handling |
preferredAdChoicesPosition | AdropAdChoicesPosition | AdChoices badge position for backfill native ads (default: TOP_RIGHT) |
context | Context | Context |
isLoaded | Boolean | Whether ad loading is complete |
isDestroyed | Boolean | Whether ad is destroyed |
creativeId | String | Creative ID |
txId | String | Transaction ID |
campaignId | String | Campaign ID |
creativeSize | CreativeSize | Creative size |
icon | String | Icon image URL |
cover | String | Cover image URL |
headline | String | Headline |
body | String | Body text |
creative | String | Creative URL |
asset | String | Asset URL |
destinationURL | String | Destination URL |
advertiser | String | Deprecated. Use profile.displayName instead. |
advertiserURL | String | Deprecated. Use profile.link instead. |
accountTag | JSONObject | Deprecated. No longer supported. |
creativeTag | JSONObject | Deprecated. No longer supported. |
callToAction | String | Call to action text |
extra | JSONObject | Extra data |
profile | AdropNativeAdProfile | Profile information |
isBackfilled | Boolean | Whether it’s a backfill ad |
browserTarget | Int | Browser target for opening destination URL |
Methods
| Method | Description |
|---|---|
load() | Load ad |
destroy() | Destroy ad |
Companion Methods
| Method | Description |
|---|---|
loads(context, unitId, contextId?, listener) | Batch load up to 5 native ads — see Batch Loading |
Usage Example
AdropNativeAdView
Container view for rendering native ads.Constructor
Properties
| Property | Type | Description |
|---|---|---|
isEntireClick | Boolean | Whether entire area is clickable |
Methods
| Method | Description |
|---|---|
setIconView(view: View, listener: OnClickListener?) | Set icon view (ImageView only) |
setHeadLineView(view: View, listener: OnClickListener?) | Set headline view (TextView only) |
setBodyView(view: View) | Set body view (TextView only) |
setMediaView(view: AdropMediaView) | Set media view |
setAdvertiserView(view: View, listener: OnClickListener?) | Set advertiser view (TextView only) |
setCallToActionView(view: View) | Set call to action button view |
setProfileNameView(view: View, listener: OnClickListener?) | Set profile name view |
setProfileLogoView(view: View, listener: OnClickListener?) | Set profile logo view (ImageView only) |
setNativeAd(ad: AdropNativeAd) | Set native ad |
destroy() | Destroy view |
Usage Example
AdropNativeAdListener
Interface for handling native ad events.Methods
| Method | Description |
|---|---|
onAdReceived(ad: AdropNativeAd) | Ad received successfully |
onAdClicked(ad: AdropNativeAd) | Ad clicked |
onAdImpression(ad: AdropNativeAd) | Ad impression (optional implementation) |
onAdFailedToReceive(ad: AdropNativeAd, errorCode: AdropErrorCode) | Failed to receive ad |
onAdVideoStart(ad: AdropNativeAd) | Video playback started (optional implementation) |
onAdVideoEnd(ad: AdropNativeAd) | Video playback ended (optional implementation) |
onAdsReceived(ads: List<AdropNativeAd>) | Batch ads received from AdropNativeAd.loads() (optional implementation) |
onAdsFailedToReceive(errorCode: AdropErrorCode) | Batch load failed from AdropNativeAd.loads() (optional implementation) |
All callbacks are called on the main thread (
@UiThread).AdropNativeAdProfile
Data class containing profile information for native ads.Properties
| Property | Type | Description |
|---|---|---|
displayLogo | String | Profile logo image URL |
displayName | String | Profile name |
link | String | Profile link URL |
Usage Example
AdropMediaView
View for displaying native ad media content.Constructor
Description
The media view displays image or video content for native ads. It should be set through thesetMediaView() method of AdropNativeAdView.
AdropInterstitialAd
Class for displaying interstitial ads.Constructor
Properties
| Property | Type | Description |
|---|---|---|
interstitialAdListener | AdropInterstitialAdListener? | Interstitial ad event listener |
closeListener | AdropInterstitialAdCloseListener? | Interstitial ad close event listener |
context | Context? | Context |
unitId | String | Ad unit ID |
isLoaded | Boolean | Whether ad loading is complete |
creativeId | String | Creative ID |
txId | String | Transaction ID |
campaignId | String | Campaign ID |
isBackfilled | Boolean | Whether it’s a backfill ad |
browserTarget | Int | Browser target for opening destination URL |
Methods
| Method | Description |
|---|---|
load() | Load ad |
show(fromActivity: Activity) | Show ad |
close() | Programmatically close the interstitial ad |
destroy() | Destroy ad |
Usage Example
AdropInterstitialAdListener
Interface for handling interstitial ad events.Methods
| Method | Description |
|---|---|
onAdReceived(ad: AdropInterstitialAd) | Ad received successfully |
onAdFailedToReceive(ad: AdropInterstitialAd, errorCode: AdropErrorCode) | Failed to receive ad |
onAdImpression(ad: AdropInterstitialAd) | Ad impression (optional implementation) |
onAdClicked(ad: AdropInterstitialAd) | Ad clicked (optional implementation) |
onAdWillPresentFullScreen(ad: AdropInterstitialAd) | Full screen ad will present (optional implementation) |
onAdDidPresentFullScreen(ad: AdropInterstitialAd) | Full screen ad did present (optional implementation) |
onAdWillDismissFullScreen(ad: AdropInterstitialAd) | Full screen ad will dismiss (optional implementation) |
onAdDidDismissFullScreen(ad: AdropInterstitialAd) | Full screen ad did dismiss (optional implementation) |
onAdFailedToShowFullScreen(ad: AdropInterstitialAd, errorCode: AdropErrorCode) | Failed to show ad (optional implementation) |
All callbacks are called on the main thread (
@UiThread).AdropInterstitialAdCloseListener
Interface for handling interstitial ad close events.Methods
| Method | Description |
|---|---|
onBackPressed(ad: AdropInterstitialAd) | Called when the back button is pressed while the interstitial ad is displayed (optional implementation) |
All callbacks are called on the main thread (
@UiThread).AdropRewardedAd
Class for displaying rewarded ads.Constructor
Properties
| Property | Type | Description |
|---|---|---|
rewardedAdListener | AdropRewardedAdListener? | Rewarded ad event listener |
context | Context? | Context |
unitId | String | Ad unit ID |
isLoaded | Boolean | Whether ad loading is complete |
creativeId | String | Creative ID |
txId | String | Transaction ID |
campaignId | String | Campaign ID |
isBackfilled | Boolean | Whether it’s a backfill ad |
serverSideVerificationOptions | ServerSideVerificationOptions? | Server-side verification options (userId, customData) |
browserTarget | Int | Browser target for opening destination URL |
Methods
| Method | Description |
|---|---|
load() | Load ad |
show(fromActivity: Activity, userDidEarnRewardHandler: AdropUserDidEarnRewardHandler) | Show ad with reward handler |
destroy() | Destroy ad |
Usage Example
AdropRewardedAdListener
Interface for handling rewarded ad events.Methods
| Method | Description |
|---|---|
onAdReceived(ad: AdropRewardedAd) | Ad received successfully |
onAdFailedToReceive(ad: AdropRewardedAd, errorCode: AdropErrorCode) | Failed to receive ad |
onAdImpression(ad: AdropRewardedAd) | Ad impression (optional implementation) |
onAdClicked(ad: AdropRewardedAd) | Ad clicked (optional implementation) |
onAdWillPresentFullScreen(ad: AdropRewardedAd) | Full screen ad will present (optional implementation) |
onAdDidPresentFullScreen(ad: AdropRewardedAd) | Full screen ad did present (optional implementation) |
onAdWillDismissFullScreen(ad: AdropRewardedAd) | Full screen ad will dismiss (optional implementation) |
onAdDidDismissFullScreen(ad: AdropRewardedAd) | Full screen ad did dismiss (optional implementation) |
onAdFailedToShowFullScreen(ad: AdropRewardedAd, errorCode: AdropErrorCode) | Failed to show ad (optional implementation) |
All callbacks are called on the main thread (
@UiThread).AdropUserDidEarnRewardHandler
Type alias called when a reward is granted.Definition
Parameters
| Parameter | Type | Description |
|---|---|---|
type | Int | Reward type |
amount | Int | Reward amount |
Usage Example
AdropPopupAd
Class for displaying popup ads.Constructor
Properties
| Property | Type | Description |
|---|---|---|
popupAdListener | AdropPopupAdListener? | Popup ad event listener |
closeListener | AdropPopupAdCloseListener? | Popup close event listener |
useCustomClick | Boolean | Whether to use custom click handling |
closeTextColor | Int? | Close button text color |
hideForTodayTextColor | Int? | ”Don’t show today” text color |
ctaTextColor | Int? | CTA button text color |
backgroundColor | Int? | Background color |
unitId | String | Ad unit ID |
creativeIds | List<String> | Creative ID list |
creativeId | String | Current creative ID |
destinationURL | String | Destination URL |
isLoaded | Boolean | Whether ad loading is complete |
txId | String | Transaction ID |
campaignId | String | Campaign ID |
browserTarget | Int | Browser target for opening destination URL |
Methods
| Method | Description |
|---|---|
load() | Load ad |
show(activity: Activity) | Show ad |
open(url: String?) | Open ad landing page |
close() | Close ad |
destroy() | Destroy ad |
Usage Example
AdropPopupAdListener
Interface for handling popup ad events.Methods
| Method | Description |
|---|---|
onAdReceived(ad: AdropPopupAd) | Ad received successfully |
onAdFailedToReceive(ad: AdropPopupAd, errorCode: AdropErrorCode) | Failed to receive ad |
onAdImpression(ad: AdropPopupAd) | Ad impression (optional implementation) |
onAdClicked(ad: AdropPopupAd) | Ad clicked (optional implementation) |
onAdWillPresentFullScreen(ad: AdropPopupAd) | Full screen ad will present (optional implementation) |
onAdDidPresentFullScreen(ad: AdropPopupAd) | Full screen ad did present (optional implementation) |
onAdWillDismissFullScreen(ad: AdropPopupAd) | Full screen ad will dismiss (optional implementation) |
onAdDidDismissFullScreen(ad: AdropPopupAd) | Full screen ad did dismiss (optional implementation) |
onAdFailedToShowFullScreen(ad: AdropPopupAd, errorCode: AdropErrorCode) | Failed to show ad (optional implementation) |
onAdVideoStart(ad: AdropPopupAd) | Video playback started (optional implementation) |
onAdVideoEnd(ad: AdropPopupAd) | Video playback ended (optional implementation) |
All callbacks are called on the main thread (
@UiThread).AdropPopupAdCloseListener
Interface for handling popup ad close events.Methods
| Method | Description |
|---|---|
onClosed(ad: AdropPopupAd) | Popup closed (optional implementation) |
onDimClicked(ad: AdropPopupAd) | Dim area clicked (optional implementation) |
onTodayOffClicked(ad: AdropPopupAd) | ”Don’t show today” clicked (optional implementation) |
All callbacks are called on the main thread (
@UiThread).AdropSplashAd
Class for displaying splash ads.Constructor
Parameters
| Parameter | Type | Description |
|---|---|---|
application | Application | Application instance |
shouldSkip | ((AdropSplashAd) -> Boolean)? | Function to determine whether to skip splash ad (optional) |
Properties
| Property | Type | Description |
|---|---|---|
splashAdListener | AdropSplashAdListener? | Splash ad event listener |
creativeId | String | Creative ID |
isClosed | Boolean | Whether ad is closed |
isDestroyed | Boolean | Whether ad is destroyed |
unitId | String | Ad unit ID |
Methods
| Method | Description |
|---|---|
close() | Close ad |
destroy() | Release resources and unregister lifecycle callbacks |
Usage Example
AdropSplashAdListener
Interface for handling splash ad events.Methods
| Method | Description |
|---|---|
onAdReceived(ad: AdropSplashAd) | Ad received successfully (optional implementation) |
onAdFailedToReceive(ad: AdropSplashAd, errorCode: AdropErrorCode) | Failed to receive ad (optional implementation) |
onAdImpression(ad: AdropSplashAd) | Ad impression (optional implementation) |
onAdClose(ad: AdropSplashAd, impressed: Boolean) | Ad closed (required implementation) |
Parameters
| Parameter | Type | Description |
|---|---|---|
impressed | Boolean | Whether the ad was actually impressed |
All callbacks are called on the main thread (
@UiThread).AdropSplashAdView
Class for displaying splash ads as a view.Constructor
Properties
| Property | Type | Description |
|---|---|---|
listener | AdropSplashAdViewListener? | Splash ad view event listener |
displayDuration | Long | Display duration (Deprecated: Set in console) |
creativeId | String | Creative ID |
isClosed | Boolean | Whether ad is closed |
unitId | String | Ad unit ID |
txId | String | Transaction ID |
campaignId | String | Campaign ID |
Methods
| Method | Description |
|---|---|
load() | Load ad |
destroy() | Release resources (timers, visibility tracker, listener) |
Usage Example
AdropSplashAdViewListener
Interface for handling splash ad view events.Methods
| Method | Description |
|---|---|
onAdReceived(ad: AdropSplashAdView) | Ad received successfully (optional implementation) |
onAdFailedToReceive(ad: AdropSplashAdView, errorCode: AdropErrorCode) | Failed to receive ad (optional implementation) |
onAdImpression(ad: AdropSplashAdView) | Ad impression (optional implementation) |
onAdClose(ad: AdropSplashAdView, impressed: Boolean) | Ad closed (required implementation) |
All callbacks are called on the main thread (
@UiThread).AdropKey
Class that defines user property keys.Constants
| Constant | Value | Description |
|---|---|---|
AGE | "AGE" | Age |
BIRTH | "BIRTH" | Date of birth |
GENDER | "GDR" | Gender |
Usage Example
AdropValue
Class that defines user property values.Common Constants
| Constant | Value | Description |
|---|---|---|
UNKNOWN | "U" | Unknown |
AdropBirth
Defines date of birth formats.| Constant | Value | Description |
|---|---|---|
formatYear | "yyyy" | Year only (e.g., 1999) |
formatYearMonth | "yyyyMM" | Year and month (e.g., 199901) |
formatYearMonthDay | "yyyyMMdd" | Year, month, and day (e.g., 19990101) |
AdropGender
Defines gender values.| Constant | Value | Description |
|---|---|---|
MALE | "M" | Male |
FEMALE | "F" | Female |
OTHER | "O" | Other |
Usage Example
CreativeSize
Data class representing the size of a creative.Properties
| Property | Type | Description |
|---|---|---|
width | Double | Width (dp) |
height | Double | Height (dp) |
Usage Example
AdropEventParam
Class for creating custom event parameters.Builder Methods
| Method | Description |
|---|---|
putBoolean(key: String, value: Boolean) | Add Boolean value |
putInt(key: String, value: Int) | Add Int value |
putFloat(key: String, value: Float) | Add Float value |
putString(key: String, value: String) | Add String value (max 1024 characters) |
putLong(key: String, value: Long) | Add Long value (max: 9007199254740991) |
putItems(items: List<AdropEventParam>) | Add item list for multi-item events |
build() | Create AdropEventParam instance |
Usage Example
- Parameter key must be 1–64 characters.
- String values are limited to 1024 characters maximum.
- The value passed to
putLong()cannot exceed JavaScript’s MAX_SAFE_INTEGER (9007199254740991).
AdropMetrics
Singleton object for managing user events and properties.Static Properties
| Property | Type | Description |
|---|---|---|
userDataConsent | Boolean | Current user data consent status (default: true) |
properties | JSONObject | Current custom user properties |
Static Methods
| Method | Description |
|---|---|
sendEvent(name: String, params: AdropEventParam?) | Send a user event |
logEvent(name: String, params: AdropEventParam?) | Deprecated. Use sendEvent instead. |
setProperty(key: String, value: Any?) | Set a user property for targeting |
setUserDataConsent(consent: Boolean) | Set user data collection consent status. When false, server transmission is blocked (local storage is still allowed). |
sendEvent
Sends a user event with optional parameters.- Event name must be 1–64 characters.
- Duplicate events with the same name and parameters are throttled (500ms window).
- The SDK must be initialized before calling
sendEvent().