Class NativeAdUnitImpl
-
- All Implemented Interfaces:
-
com.inmobi.ads.core.WinLossNotifier,com.inmobi.media.ads.common.adUnit.AdUnit,com.inmobi.media.ads.common.listeners.AUDestroyListener,com.inmobi.media.ads.nativeAd.adUnit.NativeAdUnit
public final class NativeAdUnitImpl implements NativeAdUnit
Implementation of the NativeAdUnit interface. This class provides the concrete implementation for native ad unit functionality, using a state machine to manage the ad unit lifecycle and operations.
The implementation delegates all operations to the state machine, which handles state transitions and ensures proper sequencing of ad unit operations.
-
-
Constructor Summary
Constructors Constructor Description NativeAdUnitImpl(NativeAdUnitComponent nativeAdUnitComponent)
-
Method Summary
Modifier and Type Method Description Unitinflate()Inflates the native ad unit by delegating to the state machine. UnitfillTelemetryExtras(Map<String, Object> extras)Adds the creative details of the ad this unit was built for, so that ad manager level events such as AdLoadFailedcan be attributed to a creative.UnitregisterViewForTracking(InMobiNativeViewData inMobiNativeViewData)Registers the provided view data for tracking by delegating to the state machine. UnitunTrackViews()Removes tracking from all registered views by delegating to the state machine. UnittakeAction()Handles user actions on the native ad by delegating to the state machine. StringnotifyWin(Double minBidToWin)Notify that the bid for this ad was won. StringnotifyLoss(Integer lossReason, Double auctionPrice)Notify that the bid for this ad was lost. UnitonDestroy()Destroys the native ad unit by delegating to the state machine. -
-
Constructor Detail
-
NativeAdUnitImpl
NativeAdUnitImpl(NativeAdUnitComponent nativeAdUnitComponent)
- Parameters:
nativeAdUnitComponent- The dependency injection component providing required dependencies.
-
-
Method Detail
-
inflate
Unit inflate()
Inflates the native ad unit by delegating to the state machine. This triggers the loading and preparation of the native ad content.
-
fillTelemetryExtras
Unit fillTelemetryExtras(Map<String, Object> extras)
Adds the creative details of the ad this unit was built for, so that ad manager level events such as
AdLoadFailedcan be attributed to a creative.- Parameters:
extras- The payload to add the ad context details to.
-
registerViewForTracking
Unit registerViewForTracking(InMobiNativeViewData inMobiNativeViewData)
Registers the provided view data for tracking by delegating to the state machine. This enables impression and click tracking for the native ad views.
- Parameters:
inMobiNativeViewData- The view data containing all views that need to be tracked.
-
unTrackViews
Unit unTrackViews()
Removes tracking from all registered views by delegating to the state machine. This cleans up tracking resources and prevents memory leaks.
-
takeAction
Unit takeAction()
Handles user actions on the native ad by delegating to the state machine. This triggers appropriate responses to user interactions with the ad.
-
notifyWin
String notifyWin(Double minBidToWin)
Notify that the bid for this ad was won. Delegates to the top-level notifyWin function with the AdComponent.
- Parameters:
minBidToWin- The minimum bid amount required to win the auction- Returns:
An error message string if the notification failed, null if successful
-
notifyLoss
String notifyLoss(Integer lossReason, Double auctionPrice)
Notify that the bid for this ad was lost. Delegates to the top-level notifyLoss function with the AdComponent.
- Parameters:
lossReason- The reason code for losing the auctionauctionPrice- The price of the winning bid in the auction- Returns:
An error message string if the notification failed, null if successful
-
-
-
-