Class NativeRenderedState

  • All Implemented Interfaces:
    com.inmobi.media.ads.common.base.state.State , com.inmobi.media.ads.common.listeners.AUDestroyListener , com.inmobi.media.ads.nativeAd.listeners.UnTrackListener

    
    public final class NativeRenderedState
    extends AdComponentWrapper implements State, UnTrackListener, AUDestroyListener
                        

    Represents the rendered state of a native ad unit. This state is reached when the native ad has been successfully loaded and the publisher has registered views for tracking. It handles impression tracking, click events, viewability measurement, and media events.

    • Constructor Detail

      • NativeRenderedState

        NativeRenderedState(NativeRenderedStateProvider provider, NativeAdUnitStateMachine stateMachine)
        Parameters:
        provider - The state provider containing all necessary dependencies and managers.
        stateMachine - The state machine managing the lifecycle transitions.
    • Method Detail

      • initialize

         Unit initialize()

        Initializes the rendered state by setting up tracking, event listeners, and starting impression and viewability measurements.

      • unTrackViews

         Unit unTrackViews()

        Transitions the ad unit to the untracked state.

        This method is called when the publisher wants to stop tracking the ad views, typically when the views are no longer visible or relevant. It pauses media operations, detaches observers, and creates a new untracked state while preserving essential components like ad choice and media view for potential future re-tracking.

      • takeAction

         final Unit takeAction()

        Handles user actions (such as clicks) on the native ad. This method triggers the landing page handler to process the action.

      • cleanUp

         Unit cleanUp()

        Finalizes the rendered state by cleaning up resources and stopping tracking.

      • onDestroy

         Unit onDestroy()

        Handles the destruction of the native ad unit in the rendered state.

        This method performs cleanup operations specific to the rendered state before transitioning to the destroyed state. It detaches click listeners, destroys media components, handles contextual data cleanup, and ensures proper state transition to prevent memory leaks.