-
- All Implemented Interfaces:
-
io.cloudx.sdk.CloudXDestroyable
public interface CloudXNativeAdLoader implements CloudXDestroyable
Loads and manages native ads.
Create instances using CloudX.createNativeAdLoader.
Native ads expose individual creative assets that publishers render in their own custom layout via CloudXNativeAdView and CloudXNativeAdViewBinder.
Adapter support: Native ads currently require Meta Audience Network (FAN). Bids from other adapters are rejected with a descriptive error. Additional adapter support (InMobi, Mintegral, Vungle, Unity, etc.) is planned.
-
-
Method Summary
Modifier and Type Method Description abstract UnitloadAd()Loads a native ad. abstract UnitloadAd(CloudXNativeAdView adView)Loads a native ad and renders it into adView on success. abstract Unitrender(CloudXNativeAdView adView, CloudXAd ad)Renders a previously loaded ad into a view (deferred rendering path). abstract Unitdestroy(CloudXAd ad)Destroys a specific loaded ad and releases its resources. abstract UnitsetPlacement(String placement)Sets a placement identifier for tracking and reporting. abstract UnitsetCustomData(String customData)Sets custom data for tracking and reporting. abstract UnitsetExtraParameter(String key, Object value)Sets or clears an extra parameter attached to future bid requests for this ad. abstract UnitsetLocalExtraParameter(String key, Object value)Sets or clears an adapter-level parameter for this native ad. abstract CloudXNativeAdListenergetNativeAdListener()Listener for native ad lifecycle events. abstract UnitsetNativeAdListener(CloudXNativeAdListener nativeAdListener)Listener for native ad lifecycle events. abstract CloudXAdRevenueListenergetRevenueListener()Listener for impression-level revenue events. abstract UnitsetRevenueListener(CloudXAdRevenueListener revenueListener)Listener for impression-level revenue events. abstract BooleangetIsVideoFullScreenDisabled()When true, prevents the video creative from entering fullscreen on tap. abstract UnitsetIsVideoFullScreenDisabled(Boolean isVideoFullScreenDisabled)When true, prevents the video creative from entering fullscreen on tap. abstract BooleangetIsStartVideoUnmuted()When true, starts video playback with sound enabled. abstract UnitsetIsStartVideoUnmuted(Boolean isStartVideoUnmuted)When true, starts video playback with sound enabled. abstract BooleangetIsVideoMediaControlsHidden()When true, hides video playback controls (play/pause, progress bar, etc.). abstract UnitsetIsVideoMediaControlsHidden(Boolean isVideoMediaControlsHidden)When true, hides video playback controls (play/pause, progress bar, etc.). -
-
Method Detail
-
loadAd
abstract Unit loadAd()
Loads a native ad. On success, CloudXNativeAdListener.onNativeAdLoaded is called with a null adView (deferred rendering). Use render to display.
-
loadAd
abstract Unit loadAd(CloudXNativeAdView adView)
Loads a native ad and renders it into adView on success.
- Parameters:
adView- The CloudXNativeAdView to render the ad into.
-
render
abstract Unit render(CloudXNativeAdView adView, CloudXAd ad)
Renders a previously loaded ad into a view (deferred rendering path).
- Parameters:
adView- The CloudXNativeAdView to render into.ad- The CloudXAd returned from CloudXNativeAdListener.onNativeAdLoaded.
-
destroy
abstract Unit destroy(CloudXAd ad)
Destroys a specific loaded ad and releases its resources.
- Parameters:
ad- The CloudXAd to destroy.
-
setPlacement
abstract Unit setPlacement(String placement)
Sets a placement identifier for tracking and reporting.
- Parameters:
placement- Optional placement name (e.g., "home_screen", "feed").
-
setCustomData
abstract Unit setCustomData(String customData)
Sets custom data for tracking and reporting.
- Parameters:
customData- Optional custom data string.
-
setExtraParameter
abstract Unit setExtraParameter(String key, Object value)
Sets or clears an extra parameter attached to future bid requests for this ad.
Supported value types: String, Number, Boolean, Map, Iterable, Array, and Kotlin primitive arrays. Pass
nullto remove the key. Invalid values are ignored and logged — they never fail ad loading.Reserved floor keys:
"minFloor"— single-round publisher floor in USD CPM. Accepts a Number or decimal String."minFloors"— per-round floor overrides. Accepts a List / Array of numbers or decimal strings, or a JSON-array string.
Values are captured at call time. If you pass a Map or List and later mutate it, earlier bid requests are unaffected — call
setExtraParameteragain to push updates.Mixed-validity containers: a Map keeps its valid entries and drops the invalid ones; a List / Array is all-or-nothing — any invalid element discards the entire collection, to preserve positional ordering for keys like
"minFloors".Timing: native ads use the values current at the time of loadAd; changes after that take effect on the next loadAd call.
- Parameters:
key- Parameter key.value- Value to store, ornullto remove the key.
-
setLocalExtraParameter
abstract Unit setLocalExtraParameter(String key, Object value)
Sets or clears an adapter-level parameter for this native ad. The value is forwarded to the underlying native ad adapter (e.g., Meta, InMobi) and is not sent as an auction signal.
Use setExtraParameter instead if you want the value sent in the bid request — including floor overrides (
"minFloor"/"minFloors").- Parameters:
key- Parameter key.value- Value to store, ornullto remove the key.
-
getNativeAdListener
abstract CloudXNativeAdListener getNativeAdListener()
Listener for native ad lifecycle events.
-
setNativeAdListener
abstract Unit setNativeAdListener(CloudXNativeAdListener nativeAdListener)
Listener for native ad lifecycle events.
-
getRevenueListener
abstract CloudXAdRevenueListener getRevenueListener()
Listener for impression-level revenue events.
-
setRevenueListener
abstract Unit setRevenueListener(CloudXAdRevenueListener revenueListener)
Listener for impression-level revenue events.
-
getIsVideoFullScreenDisabled
abstract Boolean getIsVideoFullScreenDisabled()
When true, prevents the video creative from entering fullscreen on tap. Set before calling loadAd. Default: false.
-
setIsVideoFullScreenDisabled
abstract Unit setIsVideoFullScreenDisabled(Boolean isVideoFullScreenDisabled)
When true, prevents the video creative from entering fullscreen on tap. Set before calling loadAd. Default: false.
-
getIsStartVideoUnmuted
abstract Boolean getIsStartVideoUnmuted()
When true, starts video playback with sound enabled. Set before calling loadAd. Default: false.
-
setIsStartVideoUnmuted
abstract Unit setIsStartVideoUnmuted(Boolean isStartVideoUnmuted)
When true, starts video playback with sound enabled. Set before calling loadAd. Default: false.
-
getIsVideoMediaControlsHidden
abstract Boolean getIsVideoMediaControlsHidden()
When true, hides video playback controls (play/pause, progress bar, etc.). Set before calling loadAd. Default: false.
-
setIsVideoMediaControlsHidden
abstract Unit setIsVideoMediaControlsHidden(Boolean isVideoMediaControlsHidden)
When true, hides video playback controls (play/pause, progress bar, etc.). Set before calling loadAd. Default: false.
-
-
-
-