Class NativeAUMStateMachine

  • All Implemented Interfaces:
    com.inmobi.ads.core.WinLossNotifier , com.inmobi.media.ads.common.listeners.AUMDestroyListener , com.inmobi.media.ads.common.listeners.AdUnitCallback , com.inmobi.media.ads.common.listeners.FetchTimeoutListener , com.inmobi.media.ads.common.listeners.FullScreenListener , com.inmobi.media.ads.common.listeners.InternalLoadTimeoutListener , com.inmobi.media.ads.common.listeners.PreloadTimeoutListener , com.inmobi.media.ads.common.listeners.VideoEventListener , com.inmobi.media.ads.nativeAd.listeners.NativeAdUnitCallback , com.inmobi.media.ads.nativeAd.listeners.RegisterTrackingListener , com.inmobi.media.ads.nativeAd.listeners.UnTrackListener

    
    public final class NativeAUMStateMachine
    extends AUMStateMachine implements RegisterTrackingListener, UnTrackListener, NativeAdUnitCallback, WinLossNotifier
                        

    State machine for managing the lifecycle and state transitions of a native ad unit manager. This class extends AUMStateMachine and implements NativeAdUnitCallback to provide native ad-specific state management, handling transitions between created, loading, and loaded states.

    • 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 registerViewForTracking(InMobiNativeViewData inMobiNativeViewData) Registers the provided view data for tracking if the ad is in the loaded state.
      Unit unTrackViews() Removes tracking from all registered views if the current state supports untracking.
      final Unit takeAction() Handles user actions (such as clicks) on the native ad if it's in the loaded state.
      Unit onLoadSuccess(NativePubData pubData) Callback for successful ad loading, forwarded to the loading state.
      Unit onAdRendered() Callback for ad rendering events, forwarded to states that listen for display events.
      Unit onVideoStarted() Callback for video started events, forwarded to video event listeners.
      Unit onVideoResumed() Callback for video resumed events, forwarded to video event listeners.
      Unit onVideoPaused() Callback for video paused events, forwarded to video event listeners.
      Unit onVideoCompleted() Callback for video completed events, forwarded to video event listeners.
      Unit onAudioStateChanged(Boolean isMuted) Callback for audio state change events, forwarded to video event listeners.
      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.
      • Methods inherited from class com.inmobi.media.ads.common.adUnitManager.state.AUMStateMachine

        fetch, inflate, load, onAdClicked, onAdFullScreenDismissed, onAdFullScreenDisplayed, onAdImpression, onDestroy, onFetchTimeout, onInternalLoadTimeout, onLoadFailure, onPreloadTimeout, onUserLeftApplication
      • Methods inherited from class com.inmobi.media.ads.common.base.state.StateMachine

        changeState, changeStateSuspending
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NativeAUMStateMachine

        NativeAUMStateMachine(AdManagerComponent adManagerComponent, NativeAdUnitManagerCallback nativeCallbacks)
        Parameters:
        adManagerComponent - The ad manager component providing core ad management functionality.
        nativeCallbacks - The callback interface for native ad unit manager events.
    • Method Detail

      • registerViewForTracking

         Unit registerViewForTracking(InMobiNativeViewData inMobiNativeViewData)

        Registers the provided view data for tracking if the ad is in the loaded state. This method 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 if the current state supports untracking. This method cleans up view tracking and can transition the ad to an untracked state.

      • takeAction

         final Unit takeAction()

        Handles user actions (such as clicks) on the native ad if it's in the loaded state. This method triggers appropriate actions when users interact with the ad.

      • onLoadSuccess

         Unit onLoadSuccess(NativePubData pubData)

        Callback for successful ad loading, forwarded to the loading state. This method is called when the native ad has been successfully loaded and prepared.

        Parameters:
        pubData - The native ad data for publisher consumption.
      • onAdRendered

         Unit onAdRendered()

        Callback for ad rendering events, forwarded to states that listen for display events. This method is called when the native ad has been rendered and is visible to users.

      • onVideoStarted

         Unit onVideoStarted()

        Callback for video started events, forwarded to video event listeners. This method is called when video content in the native ad begins playback.

      • onVideoResumed

         Unit onVideoResumed()

        Callback for video resumed events, forwarded to video event listeners. This method is called when video content in the native ad resumes after being paused.

      • onVideoPaused

         Unit onVideoPaused()

        Callback for video paused events, forwarded to video event listeners. This method is called when video content in the native ad is paused.

      • onVideoCompleted

         Unit onVideoCompleted()

        Callback for video completed events, forwarded to video event listeners. This method is called when video content in the native ad finishes playing.

      • onAudioStateChanged

         Unit onAudioStateChanged(Boolean isMuted)

        Callback for audio state change events, forwarded to video event listeners. This method is called when the audio mute state of video content changes.

        Parameters:
        isMuted - true if the audio is muted, false if unmuted.
      • notifyWin

         String notifyWin(Double minBidToWin)

        Notify that the bid for this ad was won. Delegates to the NativeAdUnit if available in the current state.

        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 NativeAdUnit if available in the current state.

        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