Skip to main content

Adrop

Class for initializing the Adrop SDK and managing global settings.

initialize

Initializes the Adrop SDK. Parameters:
  • production (boolean): Production mode (true: production, false: development)
  • targetCountries (string[], optional): Target country code array (default: [])
  • useInAppBrowser (boolean, optional): Whether to use in-app browser (default: false)
Example:

setUID

Sets the unique user identifier. Parameters:
  • uid (string): Unique user identifier
Example:

setTheme

Sets the app theme. Parameters:
  • theme (AdropTheme): Theme value (‘light’, ‘dark’, ‘auto’)
Example:

setMarketingConsent

Sets the user’s marketing consent for push notification ad targeting. Call this after initialize(). Parameters:
  • consent (boolean): true for opt-in, false for opt-out
Example:

registerWebView

Registers a native WebView for backfill ad support. Call this after the WebView is mounted. Parameters:
  • viewTag (number): Native view tag obtained via findNodeHandle() from the View wrapping the WebView
Example:
Requires adrop-ads-backfill module. If not installed, this call is silently ignored.

AdropTheme

Constant object for specifying app theme.
Values:
  • light: Light theme
  • dark: Dark theme
  • auto: Follow system setting

BrowserTarget

Enum for specifying how ad destination URLs should be opened.
Values:
  • EXTERNAL: Open URL in external browser (default)
  • INTERNAL: Open URL in in-app browser

AdropErrorCode

Error codes that may occur during ad loading and display.
Error Codes:
  • network: Network error
  • internal: Internal error
  • initialize: SDK initialization error
  • invalidUnit: Invalid ad unit
  • notTargetCountry: Not a target country
  • inactive: Deactivated ad
  • adNoFill: No ad available
  • adDuplicated: Duplicate ad load request
  • adLoading: Ad is loading
  • adEmpty: Ad is empty
  • adShown: Ad already shown
  • adHideForToday: Ad hidden for today
  • adLandscapeUnsupported: Landscape mode not supported
  • backfillNoFill: Backfill ad not available
  • undefined: Undefined error

AdropAdChoicesPosition

Enum for setting the AdChoices badge position on backfill native ads.

Definition

Values

Usage Example


AdropBanner

React component for displaying banner ads.

Props

Props:
  • style (object, required): Banner style (including height and width)
  • unitId (string, required): Ad unit ID
  • useCustomClick (boolean, optional): Custom click handling (default: false)
  • adSize (object, optional): Ad size setting
  • autoLoad (boolean, optional): Auto load (default: true)
  • onAdReceived (function, optional): Called on ad reception
  • onAdImpression (function, optional): Called on ad impression
  • onAdClicked (function, optional): Called on ad click
  • onAdFailedToReceive (function, optional): Called on ad reception failure
  • onAdVideoStart (function, optional): Called when a video ad starts playing
  • onAdVideoEnd (function, optional): Called when a video ad finishes playing

Methods

load()
Loads the ad. (Called via ref)

AdropBannerMetadata

Example:

AdropNativeAd

Class for managing native ads.

Constructor

Parameters:

Properties

isLoaded (readonly)
Returns whether the ad is loaded. unitId (readonly)
Returns the ad unit ID. requestId (readonly, deprecated)
Deprecated. This property always returns an empty string and will be removed in future versions. creativeId (readonly)
Returns the creative ID. txId (readonly)
Returns the transaction ID. campaignId (readonly)
Returns the campaign ID. useCustomClick (readonly)
Returns whether custom click handling is enabled. isBackfilled (readonly)
Returns whether it’s a backfill ad. creativeType (readonly)
Returns the loaded creative type. Returns 'display' until an ad response is received. isVideoAd (readonly)
Returns whether the ad is a video ad. browserTarget (readonly)
Returns the browser target setting. properties (readonly)
Returns ad properties. listener
Sets the ad event listener.

Methods

load()
Loads the ad. destroy()
Releases the ad instance.

AdropNativeProperties

AdropNativeProfile

AdropNativeAdListener


AdropNativeAdView

Container component for displaying native ads.

Props

Props:
  • nativeAd (AdropNativeAd, optional): Native ad instance
  • …ViewProps: All React Native View props
Example:

Native Ad View Components

Components for displaying each element of a native ad. All components must be used inside AdropNativeAdView.

AdropIconView

Displays the ad icon.
Example:

AdropHeadLineView

Displays the ad headline.
Example:

AdropBodyView

Displays the ad body text.
Example:

AdropMediaView

Displays the ad media (image/video).
Example:

AdropCallToActionView

Displays the ad CTA (Call To Action) button.
Example:

AdropAdvertiserView

Displays the advertiser information.
Example:

AdropProfileLogoView

Displays the profile logo.
Example:

AdropProfileNameView

Displays the profile name.
Example:

AdropInterstitialAd

Class for managing interstitial ads.

Constructor

Parameters:
  • unitId (string): Ad unit ID

Properties

isLoaded (readonly)
Returns whether the ad is loaded. unitId (readonly)
Returns the ad unit ID. creativeId (readonly)
Returns the creative ID. txId (readonly)
Returns the transaction ID. campaignId (readonly)
Returns the campaign ID. creativeType (readonly)
Returns the loaded creative type. Returns 'display' until an ad response is received. destinationURL (readonly)
Returns the destination URL. browserTarget (readonly)
Returns the browser target setting. listener
Sets the ad event listener.

Methods

load()
Loads the ad. show()
Shows the ad. close()
Closes the ad programmatically. destroy()
Releases the ad instance. Example:

AdropRewardedAd

Class for managing rewarded ads.

Constructor

Parameters:
  • unitId (string): Ad unit ID

Properties

Same properties as AdropInterstitialAd.

Methods

load()
Loads the ad. show()
Shows the ad. close()
Closes the ad programmatically. destroy()
Releases the ad instance. setServerSideVerificationOptions()
Sets options for server-side reward verification. Call before load().
  • options.userId (string, optional): User identifier sent in the server callback
  • options.customData (string, optional): Custom data sent in the server callback
Example:

AdropPopupAd

Class for managing popup ads.

Constructor

Parameters:
  • unitId (string): Ad unit ID
  • colors (AdropPopupAdColors, optional): Popup color customization
  • useCustomClick (boolean, optional): Custom click handling (default: false)

Properties

isLoaded (readonly)
Returns whether the ad is loaded. unitId (readonly)
Returns the ad unit ID. creativeId (readonly)
Returns the creative ID. txId (readonly)
Returns the transaction ID. campaignId (readonly)
Returns the campaign ID. creativeType (readonly)
Returns the loaded creative type. Returns 'display' until an ad response is received. destinationURL (readonly)
Returns the destination URL. browserTarget (readonly)
Returns the browser target setting. listener
Sets the ad event listener.

Methods

load()
Loads the ad. show()
Shows the ad. close()
Closes the popup ad. destroy()
Releases the ad instance.

AdropPopupAdColors

Properties:
  • closeTextColor (string, optional): Close button text color
  • hideForTodayTextColor (string, optional): ‘Hide for today’ text color
  • backgroundColor (string, optional): Background color

AdropListener

Listener interface for receiving ad events.
Events:
  • onAdReceived: Ad reception complete
  • onAdClicked: Ad clicked
  • onAdImpression: Ad impression
  • onAdFailedToReceive: Ad reception failed
  • onAdDidPresentFullScreen: Full-screen ad presented
  • onAdWillPresentFullScreen: Full-screen ad about to present
  • onAdDidDismissFullScreen: Full-screen ad dismissed
  • onAdWillDismissFullScreen: Full-screen ad about to dismiss
  • onAdFailedToShowFullScreen: Full-screen ad failed to show
  • onAdEarnRewardHandler: Reward earned (rewarded ads only)
  • onAdBackButtonPressed: Back button pressed (Android only)
  • onAdVideoStart: Video ad started playing
  • onAdVideoEnd: Video ad finished playing

useAdropInterstitialAd

Manages interstitial ads with a React Hook.

Signature

Parameters:
  • unitId (string | null): Ad unit ID
Returns:
  • load: Ad load function
  • show: Ad show function
  • reset: State reset function
  • isBackPressed: Back button pressed status (Android only)
  • isClicked: Click status
  • isClosed: Closed status
  • isEarnRewarded: Whether the user has earned a reward
  • isLoaded: Loaded status
  • isOpened: Opened status
  • isReady: Ready status
  • errorCode: Error code
  • reward: Reward info ({ type: number, amount: number } or undefined)
  • browserTarget: Browser target setting (BrowserTarget or undefined)
Example:

useAdropRewardedAd

Manages rewarded ads with a React Hook.

Signature

Parameters:
  • unitId (string | null): Ad unit ID
Returns:
  • load: Ad load function
  • show: Ad show function
  • reset: State reset function
  • isBackPressed: Back button pressed status (Android only)
  • isClicked: Click status
  • isClosed: Closed status
  • isEarnRewarded: Whether the user has earned a reward
  • isLoaded: Loaded status
  • isOpened: Opened status
  • isReady: Ready status
  • errorCode: Error code
  • reward: Reward info ({ type: number, amount: number } or undefined)
  • browserTarget: Browser target setting (BrowserTarget or undefined)
Example:

useAdropWebView

Hook for registering a WebView with the Adrop SDK. Handles view tag resolution and registration automatically.

Signature

Returns:
  • containerRef: Ref to attach to the View wrapping the WebView
  • isReady: Whether the WebView has been successfully registered
  • onLayout: Callback to trigger registration on layout
Example:

AdropMetrics

Class for managing user attributes and events.

setProperty

Sets a user property. Parameters:
  • key (string): Property key
  • value (any): Property value
Example:

sendEvent

Sends a user behavior event. Supports nested items arrays for multi-item events. Parameters:
  • name (string): Event name (1–64 characters)
  • params (Record<string, any>, optional): Event parameters
Example:

logEvent (deprecated)

Logs a custom event. Internally calls sendEvent. Parameters:
  • name (string): Event name
  • params (object, optional): Event parameters

properties

Gets all set properties. Returns:
  • Promise<Record<string, any>>: Property object

AdropProperties

Enum defining user property keys.
Values:
  • AGE: Age
  • BIRTH: Birth date
  • GENDER: Gender

AdropGender

Enum defining gender.
Values:
  • MALE: Male
  • FEMALE: Female
  • OTHER: Other
  • UNKNOWN: Unknown

AdropConsent

Class for managing user consent (GDPR, CCPA, etc.).

requestConsentInfoUpdate

Updates consent information and shows the consent popup if needed. Returns:
  • Promise<AdropConsentResult>: Consent result
Example:

getConsentStatus

Gets the current consent status. Returns:
  • Promise<AdropConsentStatus>: Current consent status
Example:

canRequestAds

Checks whether ads can be requested based on current consent. Returns:
  • Promise<boolean>: Whether ads can be requested
Example:

reset

Resets consent settings. For testing and debugging purposes. Example:

setDebugSettings

Sets debug geography for testing consent flows. Only works in DEBUG builds. Parameters:
  • geography (AdropConsentDebugGeography): Geography to simulate
Example:

AdropConsentStatus

Enum representing user consent status.
Values:
  • UNKNOWN: Not yet determined
  • REQUIRED: Consent required (popup display needed)
  • NOT_REQUIRED: Consent not required (not applicable region)
  • OBTAINED: Consent obtained

AdropConsentResult

Interface representing the result of a consent info update.
Properties:
  • status (AdropConsentStatus): Consent status
  • canRequestAds (boolean): Whether ads can be requested
  • canShowPersonalizedAds (boolean): Whether personalized ads can be shown
  • error (string, optional): Error message if any

AdropConsentDebugGeography

Enum for specifying debug geography in consent testing.
Values:
  • DISABLED: No debug setting (use actual location)
  • EEA: European Economic Area (GDPR applies)
  • NOT_EEA: (deprecated - use OTHER instead)
  • REGULATED_US_STATE: Regulated US states (California, etc., CCPA applies)
  • OTHER: Unregulated region

Deprecated APIs

The following APIs are deprecated and will be removed in future versions. Migrate to the recommended alternatives.

AdropAd.destinationUrl

destinationUrl is deprecated. Use destinationURL instead.

AdropPopupAd.createIds()

createIds() is deprecated. Use creativeId instead.

AdropNativeAd.requestId

AdropNativeAd.requestId is deprecated and always returns an empty string. This property will be removed in future versions.

AdropMetrics.logEvent()

logEvent() is deprecated. Use sendEvent() instead.