-
public class CloudXMain entry point for the CloudX SDK.
This object provides functions to initialize the SDK, create ad units, configure logging, and manage user privacy settings.
-
-
Method Summary
Modifier and Type Method Description final static StringgetVersion()Returns the current SDK version. final static BooleanisInitialized()Returns whether the SDK has been successfully initialized. final static Unitinitialize(Context context, CloudXInitializationConfiguration configuration, CloudXInitializationListener listener)Initializes the CloudX SDK. final static CloudXAdViewcreateBanner(Context context, String adUnitId)Creates a standard banner (320x50) ad view. final static CloudXAdViewcreateMREC(Context context, String adUnitId)Creates an MREC (300x250) ad view. final static CloudXInterstitialAdcreateInterstitial(Context context, String adUnitId)Creates an interstitial ad for displaying fullscreen non-rewarded ads. final static CloudXAppOpenAdcreateAppOpen(Context context, String adUnitId)Creates an app-open ad for displaying fullscreen ads on app foreground. final static CloudXRewardedAdcreateRewarded(Context context, String adUnitId)Creates a rewarded ad for displaying fullscreen rewarded ads. final static CloudXNativeAdLoadercreateNativeAdLoader(Context context, String adUnitId)Creates a native ad loader for loading and managing native ads. final static Unitarbiter(CloudXArbiterConfiguration configuration, CloudXArbiterListener listener)Runs a loaded CloudX bid against one or more publisher-supplied bids. final static UnitaddAdRevenueListener(CloudXAdRevenueListener listener)Registers a global impression-level ad revenue listener. final static UnitremoveAdRevenueListener(CloudXAdRevenueListener listener)Removes a global ad revenue listener previously added via addAdRevenueListener. final static BooleanreportRevenueData(CloudXRevenueData data)Reports impression-level ad revenue observed by the publisher, passed as data built via CloudXRevenueData.builder. final static UnitsetMinLogLevel(CloudXLogLevel minLogLevel)Sets the minimum log level for SDK logging output. final static UnitsetHashedUserId(String hashedUserId)Sets a hashed user identifier for ad targeting. final static UnitsetUserKeyValue(String key, String value)Sets a custom key-value pair for user-level targeting. final static UnitsetAppKeyValue(String key, String value)Sets a custom key-value pair for app-level targeting. final static UnitclearAllKeyValues()Clears all custom key-value pairs for both user and app-level targeting. final static UnitsetHasUserConsent(Boolean hasUserConsent)Sets the GDPR user consent flag for publishers not using a CMP. final static UnitsetDoNotSell(Boolean isDoNotSell)Sets the CCPA do-not-sell flag for publishers not using a CMP. -
-
Method Detail
-
getVersion
final static String getVersion()
Returns the current SDK version.
-
isInitialized
final static Boolean isInitialized()
Returns whether the SDK has been successfully initialized.
-
initialize
final static Unit initialize(Context context, CloudXInitializationConfiguration configuration, CloudXInitializationListener listener)
Initializes the CloudX SDK. Must be called before loading or displaying any ads.
- Parameters:
context- Android context (Activity or Application).configuration- Configuration parameters including the SDK key and test mode settings.listener- Optional callback to receive initialization success or failure events.
-
createBanner
final static CloudXAdView createBanner(Context context, String adUnitId)
Creates a standard banner (320x50) ad view.
- Parameters:
adUnitId- The ad unit ID configured in the CloudX dashboard.
-
createMREC
final static CloudXAdView createMREC(Context context, String adUnitId)
Creates an MREC (300x250) ad view.
- Parameters:
adUnitId- The ad unit ID configured in the CloudX dashboard.
-
createInterstitial
final static CloudXInterstitialAd createInterstitial(Context context, String adUnitId)
Creates an interstitial ad for displaying fullscreen non-rewarded ads.
- Parameters:
context- This parameter is reserved for future use.adUnitId- The ad unit ID configured in the CloudX dashboard.
-
createAppOpen
final static CloudXAppOpenAd createAppOpen(Context context, String adUnitId)
Creates an app-open ad for displaying fullscreen ads on app foreground.
- Parameters:
context- This parameter is reserved for future use.adUnitId- The ad unit ID configured in the CloudX dashboard.
-
createRewarded
final static CloudXRewardedAd createRewarded(Context context, String adUnitId)
Creates a rewarded ad for displaying fullscreen rewarded ads.
- Parameters:
context- This parameter is reserved for future use.adUnitId- The ad unit ID configured in the CloudX dashboard.
-
createNativeAdLoader
final static CloudXNativeAdLoader createNativeAdLoader(Context context, String adUnitId)
Creates a native ad loader for loading and managing native ads.
- Parameters:
context- This parameter is reserved for future use.adUnitId- The ad unit ID configured in the CloudX dashboard.
-
arbiter
final static Unit arbiter(CloudXArbiterConfiguration configuration, CloudXArbiterListener listener)
Runs a loaded CloudX bid against one or more publisher-supplied bids.
The SDK submits the configured bids to the Trusted Arbiter and returns the selected platform through CloudXArbiterListener. If that request fails, the SDK falls back to the highest plaintext bid supplied to configuration. Supported V0 bid inputs are normalized to per-impression USD for this fallback path.
-
addAdRevenueListener
final static Unit addAdRevenueListener(CloudXAdRevenueListener listener)
Registers a global impression-level ad revenue listener.
Unlike the per-ad
revenueListenerproperty, a global listener fires for every CloudX-won impression across all ad objects and all ad formats — no per-instance wiring. Multiple listeners can be registered; each is invoked once per impression with the same immutable CloudXAd snapshot delivered to the per-ad listener. This is the surface analytics and MMP SDKs attach to for CloudX ad revenue.Registration is idempotent per instance and works before or after initialize. Listeners must not block; a listener that throws is isolated and skipped, never affecting the ad flow or other listeners.
- Parameters:
listener- The listener to add.
-
removeAdRevenueListener
final static Unit removeAdRevenueListener(CloudXAdRevenueListener listener)
Removes a global ad revenue listener previously added via addAdRevenueListener. No-op if the listener was never registered.
-
reportRevenueData
final static Boolean reportRevenueData(CloudXRevenueData data)
Reports impression-level ad revenue observed by the publisher, passed as data built via CloudXRevenueData.builder.
Returns
trueif the data was used — either accepted into the CloudX ILRD pipeline, or, when adRevenue tracking is not enabled by the server config, accepted for realized-price recording. Returnsfalseif it was dropped, because the SDK is not initialized, the reported platform name is blank, or nothing consumed the event. Acceptance is not a delivery guarantee — reporting itself is fire-and-forget async.
-
setMinLogLevel
final static Unit setMinLogLevel(CloudXLogLevel minLogLevel)
Sets the minimum log level for SDK logging output. Use CloudXLogLevel.NONE to disable all logging.
- Parameters:
minLogLevel- The minimum CloudXLogLevel to display.
-
setHashedUserId
final static Unit setHashedUserId(String hashedUserId)
Sets a hashed user identifier for ad targeting.
- Parameters:
hashedUserId- A pre-hashed user identifier.
-
setUserKeyValue
final static Unit setUserKeyValue(String key, String value)
Sets a custom key-value pair for user-level targeting.
- Parameters:
key- The key identifier for the targeting parameter.value- The value associated with the key.
-
setAppKeyValue
final static Unit setAppKeyValue(String key, String value)
Sets a custom key-value pair for app-level targeting.
- Parameters:
key- The key identifier for the targeting parameter.value- The value associated with the key.
-
clearAllKeyValues
final static Unit clearAllKeyValues()
Clears all custom key-value pairs for both user and app-level targeting.
-
setHasUserConsent
final static Unit setHasUserConsent(Boolean hasUserConsent)
Sets the GDPR user consent flag for publishers not using a CMP.
This is a fallback: if IAB consent strings (GPP/TCF) are present in SharedPreferences, they take priority over this manual flag.
Can be called before or after SDK initialization. Post-init, the value is forwarded to adapter and mediator privacy handlers automatically.
- Parameters:
hasUserConsent- true if user has given consent, false if denied, null to clear.
-
setDoNotSell
final static Unit setDoNotSell(Boolean isDoNotSell)
Sets the CCPA do-not-sell flag for publishers not using a CMP.
This is a fallback: if IAB consent strings (GPP/US Privacy) are present in SharedPreferences, they take priority over this manual flag.
Can be called before or after SDK initialization. Post-init, the value is forwarded to adapter and mediator privacy handlers automatically.
- Parameters:
isDoNotSell- true if user opted out of sale, false if not, null to clear.
-
-
-
-