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.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Unit inflate() Inflates the native ad unit by delegating to the state machine.
      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 AdLoadFailed can be attributed to a creative.
      Unit registerViewForTracking(InMobiNativeViewData inMobiNativeViewData) Registers the provided view data for tracking by delegating to the state machine.
      Unit unTrackViews() Removes tracking from all registered views by delegating to the state machine.
      Unit takeAction() Handles user actions on the native ad by delegating to the state machine.
      String notifyWin(Double minBidToWin) Notify that the bid for this ad was won.
      String notifyLoss(Integer lossReason, Double auctionPrice) Notify that the bid for this ad was lost.
      Unit onDestroy() Destroys the native ad unit by delegating to the state machine.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 AdLoadFailed can 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 auction
        auctionPrice - The price of the winning bid in the auction
        Returns:

        An error message string if the notification failed, null if successful

      • onDestroy

         Unit onDestroy()

        Destroys the native ad unit by delegating to the state machine. This performs complete cleanup of all resources and stops all operations.